﻿using Newtonsoft.Json;
using Oybab.DAL;
using Oybab.ServerManager.Exceptions;
using Oybab.ServerManager.Model.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Text;
using System.Transactions;

namespace Oybab.ServerManager.Operate
{
    internal sealed class DBUpdate
    {
        #region Instance
        private DBUpdate() { }
        private static readonly Lazy<DBUpdate> lazy = new Lazy<DBUpdate>(() => new DBUpdate());
        public static DBUpdate Instance { get { return lazy.Value; } }
        #endregion Instance

        // 每次升级时: 要修改这里, 在底部的switch增加一个, 并在底部新增SQL脚本
        private int CurrentNewVersion = 16;


        internal void UpdateDatabase(Database oldDatabase)
        {
            try
            {

                // 获取数据库版本号
                int oldVersion = 0;
                int loopCount = 0;

                if (null != oldDatabase)
                {
                    oldVersion = int.Parse(oldDatabase.DatabaseVersion);
                }

                // 只要是当前版本号小于目前新版本号, 就得循环更新
                while (oldVersion < CurrentNewVersion)
                {
                    ++loopCount;
                    if (loopCount > 99)
                    {
                        throw new Exception("Database update requests frequency excessive!");
                    }

                    string sqlUpdateStatement = null;
                    int currentNewVersionNo = 0;
                    bool IsCleanDB = false;
                    switch (oldVersion)
                    {
                        // 如果当前版本为5,升级为6
                        case 5:
                            sqlUpdateStatement = SqlUpdateStatementVersion6;
                            currentNewVersionNo = 6;
                            break;
                        // 如果当前版本为6,升级为7
                        case 6:
                            sqlUpdateStatement = SqlUpdateStatementVersion7;
                            currentNewVersionNo = 7;
                            break;
                        // 如果当前版本为7,升级为8
                        case 7:
                            sqlUpdateStatement = SqlUpdateStatementVersion8;
                            currentNewVersionNo = 8;
                            break;
                        // 如果当前版本为8,升级为9
                        case 8:
                            sqlUpdateStatement = SqlUpdateStatementVersion9;
                            currentNewVersionNo = 9;
                            break;
                        case 9:
                            sqlUpdateStatement = SqlUpdateStatementVersion10;
                            currentNewVersionNo = 10;
                            break;
                        case 10:
                            sqlUpdateStatement = SqlUpdateStatementVersion11;
                            currentNewVersionNo = 11;
                            break;
                        case 11:
                            sqlUpdateStatement = SqlUpdateStatementVersion12;
                            currentNewVersionNo = 12;
                            break;
                        case 12:
                            sqlUpdateStatement = SqlUpdateStatementVersion13;
                            currentNewVersionNo = 13;
                            break;
                        case 13:
                            sqlUpdateStatement = SqlUpdateStatementVersion14;
                            currentNewVersionNo = 14;
                            break;
                        case 14:
                            sqlUpdateStatement = SqlUpdateStatementVersion15;
                            currentNewVersionNo = 15;
                            IsCleanDB = true;
                            break;
                        case 15:
                            sqlUpdateStatement = SqlUpdateStatementVersion16;
                            currentNewVersionNo = 16;
                            break;
                    }




                    // 升级
                    if (null != sqlUpdateStatement && currentNewVersionNo != 0)
                    {
                        using (tsEntities ctx = new tsEntities(DBOperate.GetDBOperate().CONS, false))
                        {
                            ctx.Configuration.ProxyCreationEnabled = false;
                            ((IObjectContextAdapter)ctx).ObjectContext.CommandTimeout = Resources.GetRes().TIME_OUT_LONG;//无用

                            TransactionOptions option = new TransactionOptions();
                            option.Timeout = TimeSpan.FromSeconds(Resources.GetRes().TIME_OUT_LONG);//无用
                            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option, EnterpriseServicesInteropOption.Automatic))
                            {
                                ctx.Configuration.AutoDetectChangesEnabled = false;
                                ctx.Configuration.ValidateOnSaveEnabled = false;

                                // 修改处
                                string command = sqlUpdateStatement;


                                Database newDatabase = new Database();
                                newDatabase.DatabaseId = 1;
                                // 修改处
                                newDatabase.DatabaseVersion = currentNewVersionNo.ToString();
                                newDatabase.LastDatabaseVersion = oldDatabase.DatabaseVersion;
                                newDatabase.LastDatabaseUpdateTime = oldDatabase.UpdateTime; // 这里下次写入上次记录更新时间
                                newDatabase.UpdateTime = long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss"));

                                command = ";PRAGMA foreign_keys=OFF; " + command;


                                command += string.Format("update 'main'.'tb_database' set  DatabaseId={0}, TokenId={1}, DatabaseVersion={2} , LastDatabaseVersion={3}, LastDatabaseUpdateTime={4}, MarkType={5}, MarkExpireTime={6}, UpdateTime={7}, Remark={8} where DatabaseId={9};", newDatabase.DatabaseId, (null == newDatabase.TokenId ? "null" : newDatabase.TokenId.ToString()), newDatabase.DatabaseVersion, newDatabase.LastDatabaseVersion, (null == newDatabase.LastDatabaseUpdateTime ? "null" : newDatabase.LastDatabaseUpdateTime.ToString()), (null == newDatabase.MarkType ? "null" : newDatabase.MarkType.ToString()), (null == newDatabase.MarkExpireTime ? "null" : newDatabase.MarkExpireTime.ToString()), newDatabase.UpdateTime, (null == newDatabase.Remark ? "null" : string.Format("'{0}'", newDatabase.Remark)), newDatabase.DatabaseId);

                                command = command + ";PRAGMA foreign_keys=ON;";

                                ctx.Database.ExecuteSqlCommand(command);

                                ctx.SaveChanges();
                                scope.Complete();

                                oldDatabase = newDatabase;
                                // 修改处
                                oldDatabase.DatabaseVersion = (oldVersion = currentNewVersionNo).ToString();



                                OperateLog.Instance.AddRecord(0, null, "Database#" + OperateType.Edit, null, null, "Update To: " + currentNewVersionNo);


                                

                            }

                        }


                        if (IsCleanDB)
                        {
                            using (tsEntities ctx = new tsEntities(DBOperate.GetDBOperate().CONS, false))
                            {
                                ctx.Configuration.ProxyCreationEnabled = false;
                                ((IObjectContextAdapter)ctx).ObjectContext.CommandTimeout = Resources.GetRes().TIME_OUT_LONG;//无用
                                ctx.Configuration.AutoDetectChangesEnabled = false;
                                ctx.Configuration.ValidateOnSaveEnabled = false;

                                ctx.Database.ExecuteSqlCommand(System.Data.Entity.TransactionalBehavior.DoNotEnsureTransaction, "vacuum;");
                                //string command = "vacuum;";
                                //ctx.Database.ExecuteSqlCommand(command);
                                ctx.SaveChanges();
                            }
                            IsCleanDB = false;
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                ExceptionPro.ExpErrorLog("Database update failed!");
                throw ex;
            }
        }


        // add IsScales for tb_product
        private string SqlUpdateStatementVersion6 = "ALTER TABLE tb_product ADD IsScales INTEGER NOT NULL DEFAULT 0;";
        // add sale price and original sale price to tb_importdetails
        private string SqlUpdateStatementVersion7 = "ALTER TABLE tb_importdetail ADD SalePrice REAL NOT NULL DEFAULT 0;ALTER TABLE tb_importdetail ADD OriginalSalePrice REAL NOT NULL DEFAULT 0;ALTER TABLE tb_importdetail ADD PriceMode INTEGER NOT NULL DEFAULT 0;";
        // add cost price to order details and takeout details, add cardno to member and supplier
        private string SqlUpdateStatementVersion8 = "ALTER TABLE tb_orderdetail ADD TotalCostPrice REAL NOT NULL DEFAULT 0;ALTER TABLE tb_takeoutdetail ADD TotalCostPrice REAL NOT NULL DEFAULT 0;  ALTER TABLE tb_member ADD CardNo TEXT(50) DEFAULT NULL;   ALTER TABLE tb_supplier ADD CardNo TEXT(50) DEFAULT NULL; CREATE INDEX \"main\".\"tb_member_CardNo\" ON \"tb_member\" (\"CardNo\" ASC);CREATE INDEX \"main\".\"tb_supplier_CardNo\" ON \"tb_supplier\" (\"CardNo\" ASC);";

        // add FreeRoomPriceLimit for tb_room, also add IsPayByTime and IsFreeRoomPrice to tb_order
        private string SqlUpdateStatementVersion9 = "ALTER TABLE tb_room ADD FreeRoomPriceLimit REAL NOT NULL DEFAULT 0; ALTER TABLE tb_order ADD IsPayByTime INTEGER NOT NULL DEFAULT 0; ALTER TABLE tb_order ADD IsFreeRoomPrice INTEGER NOT NULL DEFAULT 0;";

        // update about pay, a new design that support multiple way of pay.
        private string SqlUpdateStatementVersion10 = "ALTER TABLE tb_balance ADD RemoveRate REAL NOT NULL DEFAULT 0; ALTER TABLE tb_balance ADD HideType INTEGER NOT NULL DEFAULT 0; ALTER TABLE tb_balance ADD \"Order\" INTEGER NOT NULL DEFAULT 100; " +
            "ALTER TABLE tb_balancepay ADD RemoveRate REAL NOT NULL DEFAULT 0; ALTER TABLE tb_balancepay ADD OriginalPrice REAL NOT NULL DEFAULT 0; ALTER TABLE tb_balancepay ADD RemovePrice REAL NOT NULL DEFAULT 0; " +
            "ALTER TABLE\"main\".\"tb_memberpay\"RENAME TO\"_tb_memberpay_old_20200201_1\";DROP INDEX\"main\".\"tb_memberPay_isPaybyCard\";DROP INDEX\"main\".\"tb_memberpay_addTime\";DROP INDEX\"main\".\"tb_memberpay_adminId\";DROP INDEX\"main\".\"tb_memberpay_deviceId\";DROP INDEX\"main\".\"tb_memberpay_memberId\";DROP INDEX\"main\".\"tb_memberpay_mode\";CREATE TABLE\"main\".\"tb_memberpay\"(\"MemberPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"MemberId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL DEFAULT 1,\"IsPayByCard\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 100,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\") ON DELETE RESTRICT ON UPDATE RESTRICT );INSERT INTO\"main\".\"tb_memberpay\"(\"MemberPayId\",\"MemberId\",\"IsPayByCard\",\"Price\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"MemberPayId\",\"MemberId\",\"IsPayByCard\",\"Price\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_memberpay_old_20200201_1\";CREATE INDEX\"main\".\"tb_memberPay_isPaybyCard\"ON\"tb_memberpay\"(\"IsPayByCard\"ASC);CREATE INDEX\"main\".\"tb_memberpay_addTime\"ON\"tb_memberpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_memberpay_adminId\"ON\"tb_memberpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_deviceId\"ON\"tb_memberpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_memberId\"ON\"tb_memberpay\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_mode\"ON\"tb_memberpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_memberpay_balanceId\"ON\"tb_memberpay\"(\"BalanceId\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_memberpay';" +
            "ALTER TABLE\"main\".\"tb_supplierpay\"RENAME TO\"_tb_supplierpay_old_20200201\";DROP INDEX\"main\".\"tb_supplierPay_isPaybyCard\";DROP INDEX\"main\".\"tb_supplierpay_addTime\";DROP INDEX\"main\".\"tb_supplierpay_adminId\";DROP INDEX\"main\".\"tb_supplierpay_deviceId\";DROP INDEX\"main\".\"tb_supplierpay_mode\";DROP INDEX\"main\".\"tb_supplierpay_supplierId\";CREATE TABLE\"main\".\"tb_supplierpay\"(\"SupplierPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"SupplierId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL DEFAULT 1,\"IsPayByCard\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 100,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"supplierpay_fk_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"supplierpay_fk_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"supplierpay_fk_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"supplierpay_fk_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\") ON DELETE RESTRICT ON UPDATE RESTRICT );INSERT INTO\"main\".\"tb_supplierpay\"(\"SupplierPayId\",\"SupplierId\",\"IsPayByCard\",\"Price\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"SupplierPayId\",\"SupplierId\",\"IsPayByCard\",\"Price\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_supplierpay_old_20200201\";CREATE INDEX\"main\".\"tb_supplierPay_isPaybyCard\"ON\"tb_supplierpay\"(\"IsPayByCard\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_addTime\"ON\"tb_supplierpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_adminId\"ON\"tb_supplierpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_deviceId\"ON\"tb_supplierpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_mode\"ON\"tb_supplierpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_supplierId\"ON\"tb_supplierpay\"(\"SupplierId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_balanceId\"ON\"tb_supplierpay\"(\"BalanceId\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_supplierpay';" +
            "CREATE TABLE\"main\".\"tb_orderpay\"(\"OrderPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"OrderId\"INTEGER NOT NULL,\"BalanceId\"INTEGER,\"MemberId\"INTEGER,\"IsPayByCard\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"Rate\"REAL NOT NULL DEFAULT 100,\"RemovePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_orderpay_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderpay_orderId\"FOREIGN KEY(\"OrderId\")REFERENCES\"tb_order\"(\"OrderId\")ON DELETE RESTRICT ON UPDATE RESTRICT);CREATE INDEX\"main\".\"orderpay_orderId\"ON\"tb_orderpay\"(\"OrderId\"ASC);CREATE INDEX\"main\".\"orderpay_balanceId\"ON\"tb_orderpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"orderpay_memberId\"ON\"tb_orderpay\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"orderpay_adminId\"ON\"tb_orderpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"orderpay_mode\"ON\"tb_orderpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"orderpay_deviceId\"ON\"tb_orderpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"orderpay_state\"ON\"tb_orderpay\"(\"State\"ASC);CREATE INDEX\"main\".\"orderpay_addTime\"ON\"tb_orderpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"orderpay_updateTime\"ON\"tb_orderpay\"(\"UpdateTime\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_orderpay';CREATE TABLE\"main\".\"tb_takeoutpay\"(\"TakeoutPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"TakeoutId\"INTEGER NOT NULL,\"BalanceId\"INTEGER,\"MemberId\"INTEGER,\"IsPayByCard\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"Rate\"REAL NOT NULL DEFAULT 100,\"RemovePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_takeoutpay_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutpay_TakeoutId\"FOREIGN KEY(\"TakeoutId\")REFERENCES\"tb_takeout\"(\"TakeoutId\")ON DELETE RESTRICT ON UPDATE RESTRICT);CREATE INDEX\"main\".\"takeoutpay_takeoutId\"ON\"tb_takeoutpay\"(\"TakeoutId\"ASC);CREATE INDEX\"main\".\"takeoutpay_balanceId\"ON\"tb_takeoutpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"takeoutpay_memberId\"ON\"tb_takeoutpay\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"takeoutpay_adminId\"ON\"tb_takeoutpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"takeoutpay_mode\"ON\"tb_takeoutpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"takeoutpay_deviceId\"ON\"tb_takeoutpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"takeoutpay_state\"ON\"tb_takeoutpay\"(\"State\"ASC);CREATE INDEX\"main\".\"takeoutpay_addTime\"ON\"tb_takeoutpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"takeoutpay_updateTime\"ON\"tb_takeoutpay\"(\"UpdateTime\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_takeoutpay';CREATE TABLE\"main\".\"tb_importpay\"(\"ImportPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ImportId\"INTEGER NOT NULL,\"BalanceId\"INTEGER,\"SupplierId\"INTEGER,\"IsPayByCard\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"Rate\"REAL NOT NULL DEFAULT 100,\"RemovePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_importpay_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importpay_importId\"FOREIGN KEY(\"ImportId\")REFERENCES\"tb_import\"(\"ImportId\")ON DELETE RESTRICT ON UPDATE RESTRICT);CREATE INDEX\"main\".\"importpay_importId\"ON\"tb_importpay\"(\"ImportId\"ASC);CREATE INDEX\"main\".\"importpay_balanceId\"ON\"tb_importpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"importpay_supplierId\"ON\"tb_importpay\"(\"SupplierId\"ASC);CREATE INDEX\"main\".\"importpay_adminId\"ON\"tb_importpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"importpay_mode\"ON\"tb_importpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"importpay_deviceId\"ON\"tb_importpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"importpay_state\"ON\"tb_importpay\"(\"State\"ASC);CREATE INDEX\"main\".\"importpay_addTime\"ON\"tb_importpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"importpay_updateTime\"ON\"tb_importpay\"(\"UpdateTime\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_importpay';CREATE TABLE\"main\".\"tb_returnpay\"(\"ReturnPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ReturnId\"INTEGER NOT NULL,\"BalanceId\"INTEGER,\"SupplierId\"INTEGER,\"IsPayByCard\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"Rate\"REAL NOT NULL DEFAULT 100,\"RemovePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_returnpay_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_returnpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_returnpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_returnpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_returnpay_returnId\"FOREIGN KEY(\"ReturnId\")REFERENCES\"tb_return\"(\"ReturnId\")ON DELETE RESTRICT ON UPDATE RESTRICT);CREATE INDEX\"main\".\"returnpay_returnId\"ON\"tb_returnpay\"(\"ReturnId\"ASC);CREATE INDEX\"main\".\"returnpay_balanceId\"ON\"tb_returnpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"returnpay_supplierId\"ON\"tb_returnpay\"(\"SupplierId\"ASC);CREATE INDEX\"main\".\"returnpay_adminId\"ON\"tb_returnpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"returnpay_mode\"ON\"tb_returnpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"returnpay_deviceId\"ON\"tb_returnpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"returnpay_state\"ON\"tb_returnpay\"(\"State\"ASC);CREATE INDEX\"main\".\"returnpay_addTime\"ON\"tb_returnpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"returnpay_updateTime\"ON\"tb_returnpay\"(\"UpdateTime\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_returnpay';" +
            "drop table \"_tb_memberpay_old_20200201_1\"; drop table \"_tb_supplierpay_old_20200201\";";

        // still update about pay, add pay price into every pay for track it , money is important need to track!
        private string SqlUpdateStatementVersion11 = "ALTER TABLE tb_memberpay ADD BalancePrice REAL NOT NULL DEFAULT 0; ALTER TABLE tb_supplierpay ADD BalancePrice REAL NOT NULL DEFAULT 0; ALTER TABLE tb_orderpay ADD BalancePrice REAL NOT NULL DEFAULT 0; ALTER TABLE tb_takeoutpay ADD BalancePrice REAL NOT NULL DEFAULT 0; ALTER TABLE tb_importpay ADD BalancePrice REAL NOT NULL DEFAULT 0; ALTER TABLE tb_returnpay ADD BalancePrice REAL NOT NULL DEFAULT 0; " +
            "ALTER TABLE\"main\".\"tb_adminpay\"RENAME TO\"_tb_adminpay_old_20200202\";DROP INDEX\"main\".\"tb_adminPay_addAdminId\";DROP INDEX\"main\".\"tb_adminPay_addTime\";DROP INDEX\"main\".\"tb_adminPay_adminId\";DROP INDEX\"main\".\"tb_adminPay_deviceId\";DROP INDEX\"main\".\"tb_adminPay_isPaybyCard\";DROP INDEX\"main\".\"tb_adminPay_mode\";CREATE TABLE\"main\".\"tb_adminpay\"(\"AdminPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"AdminId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL DEFAULT 1,\"IsPayByCard\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"RemoveRate\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"AddAdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_addAdminId\"FOREIGN KEY(\"AddAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_balancePrice_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_adminpay\"(\"AdminPayId\",\"AdminId\",\"IsPayByCard\",\"Price\",\"AddAdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"AdminPayId\",\"AdminId\",\"IsPayByCard\",\"Price\",\"AddAdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_adminpay_old_20200202\";CREATE INDEX\"main\".\"tb_adminPay_addAdminId\"ON\"tb_adminpay\"(\"AddAdminId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_addTime\"ON\"tb_adminpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_adminPay_adminId\"ON\"tb_adminpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_deviceId\"ON\"tb_adminpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_isPaybyCard\"ON\"tb_adminpay\"(\"IsPayByCard\"ASC);CREATE INDEX\"main\".\"tb_adminPay_mode\"ON\"tb_adminpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_adminPay_balanceId\"ON\"tb_adminpay\"(\"BalanceId\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_adminpay';" +
            "ALTER TABLE tb_import ADD State INTEGER NOT NULL DEFAULT 0; CREATE INDEX \"main\".\"tb_import_state\" ON \"tb_import\" (\"State\" ASC); ALTER TABLE tb_importdetail ADD State INTEGER NOT NULL DEFAULT 0; CREATE INDEX \"main\".\"tb_importdetail_state\" ON \"tb_importdetail\" (\"State\" ASC);" + 
            "drop table \"_tb_adminpay_old_20200202\";";

        // return cardpaidprice, returnprice, dealsprice, memberdealsprice, actualprice from tables, and rename the forign key names.
        private string SqlUpdateStatementVersion12 = "ALTER TABLE\"main\".\"tb_adminpay\"RENAME TO\"_tb_adminpay_old_20200206\";DROP INDEX\"main\".\"tb_adminPay_addAdminId\";DROP INDEX\"main\".\"tb_adminPay_addTime\";DROP INDEX\"main\".\"tb_adminPay_adminId\";DROP INDEX\"main\".\"tb_adminPay_balanceId\";DROP INDEX\"main\".\"tb_adminPay_deviceId\";DROP INDEX\"main\".\"tb_adminPay_isPaybyCard\";DROP INDEX\"main\".\"tb_adminPay_mode\";CREATE TABLE\"main\".\"tb_adminpay\"(\"AdminPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"AdminId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"RemoveRate\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"AddAdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_adminpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_addAdminId\"FOREIGN KEY(\"AddAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_adminpay\"(\"AdminPayId\",\"AdminId\",\"BalanceId\",\"OriginalPrice\",\"RemoveRate\",\"Price\",\"BalancePrice\",\"AddAdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"AdminPayId\",\"AdminId\",\"BalanceId\",\"OriginalPrice\",\"RemoveRate\",\"Price\",\"BalancePrice\",\"AddAdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_adminpay_old_20200206\";CREATE INDEX\"main\".\"tb_adminPay_addAdminId\"ON\"tb_adminpay\"(\"AddAdminId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_addTime\"ON\"tb_adminpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_adminPay_adminId\"ON\"tb_adminpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_balanceId\"ON\"tb_adminpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_deviceId\"ON\"tb_adminpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_mode\"ON\"tb_adminpay\"(\"Mode\"ASC);ALTER TABLE\"main\".\"tb_device\"RENAME TO\"_tb_device_old_20200206\";DROP INDEX\"main\".\"index_deviceNo\";CREATE TABLE\"main\".\"tb_device\"(\"DeviceId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"DeviceNo\"TEXT(50)NOT NULL,\"DeviceType\"INTEGER NOT NULL,\"IpAddress\"TEXT(50)NOT NULL,\"MacAddress\"TEXT(50),\"RoomId\"INTEGER,\"Order\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT,CONSTRAINT\"fk_device_roomId\"FOREIGN KEY(\"RoomId\")REFERENCES\"tb_room\"(\"RoomId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_device\"(\"DeviceId\",\"DeviceNo\",\"DeviceType\",\"IpAddress\",\"MacAddress\",\"RoomId\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"DeviceId\",\"DeviceNo\",\"DeviceType\",\"IpAddress\",\"MacAddress\",\"RoomId\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_device_old_20200206\";CREATE UNIQUE INDEX\"main\".\"fk_device_deviceNo\"ON\"tb_device\"(\"DeviceNo\"ASC);ALTER TABLE\"main\".\"tb_import\"RENAME TO\"_tb_import_old_20200206\";DROP INDEX\"main\".\"tb_import_addtime\";DROP INDEX\"main\".\"tb_import_adminId\";DROP INDEX\"main\".\"tb_import_deviceId\";DROP INDEX\"main\".\"tb_import_importtime\";DROP INDEX\"main\".\"tb_import_mode\";DROP INDEX\"main\".\"tb_import_recheckedcount\";DROP INDEX\"main\".\"tb_import_state\";DROP INDEX\"main\".\"tb_import_supplierId\";DROP INDEX\"main\".\"tb_import_updatetime\";CREATE TABLE\"main\".\"tb_import\"(\"ImportId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"ImportTime\"INTEGER NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"SupplierPaidPrice\"REAL NOT NULL,\"PaidPrice\"REAL NOT NULL,\"TotalPaidPrice\"REAL NOT NULL,\"BorrowPrice\"REAL NOT NULL,\"KeepPrice\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"SupplierId\"INTEGER,\"Mode\"INTEGER NOT NULL,\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"ReCheckedCount\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_import_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_import_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_import_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_import\"(\"ImportId\",\"State\",\"ImportTime\",\"OriginalTotalPrice\",\"TotalPrice\",\"SupplierPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"AdminId\",\"DeviceId\",\"SupplierId\",\"Mode\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"Remark\")SELECT\"ImportId\",\"State\",\"ImportTime\",\"OriginalTotalPrice\",\"TotalPrice\",\"SupplierPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"AdminId\",\"DeviceId\",\"SupplierId\",\"Mode\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"Remark\"FROM\"_tb_import_old_20200206\";CREATE INDEX\"main\".\"tb_import_addtime\"ON\"tb_import\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_import_adminId\"ON\"tb_import\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_import_deviceId\"ON\"tb_import\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_import_importtime\"ON\"tb_import\"(\"ImportTime\"ASC);CREATE INDEX\"main\".\"tb_import_mode\"ON\"tb_import\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_import_recheckedcount\"ON\"tb_import\"(\"ReCheckedCount\"ASC);CREATE INDEX\"main\".\"tb_import_state\"ON\"tb_import\"(\"State\"ASC);CREATE INDEX\"main\".\"tb_import_supplierId\"ON\"tb_import\"(\"SupplierId\"ASC);CREATE INDEX\"main\".\"tb_import_updatetime\"ON\"tb_import\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_importdetail\"RENAME TO\"_tb_importdetail_old_20200206\";DROP INDEX\"main\".\"tb_importdetail_addtime\";DROP INDEX\"main\".\"tb_importdetail_adminid\";DROP INDEX\"main\".\"tb_importdetail_deviceId\";DROP INDEX\"main\".\"tb_importdetail_importid\";DROP INDEX\"main\".\"tb_importdetail_mode\";DROP INDEX\"main\".\"tb_importdetail_productid\";DROP INDEX\"main\".\"tb_importdetail_state\";DROP INDEX\"main\".\"tb_importdetail_updatetime\";CREATE TABLE\"main\".\"tb_importdetail\"(\"ImportDetailId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ImportId\"INTEGER NOT NULL,\"ProductId\"INTEGER NOT NULL,\"Price\"REAL NOT NULL,\"Count\"REAL NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"PriceMode\"INTEGER NOT NULL DEFAULT 0,\"SalePrice\"REAL NOT NULL DEFAULT 0,\"OriginalSalePrice\"REAL NOT NULL DEFAULT 0,\"State\"INTEGER NOT NULL DEFAULT 0,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_importdetail_productid\"FOREIGN KEY(\"ProductId\")REFERENCES\"tb_product\"(\"ProductId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importdetail_importid\"FOREIGN KEY(\"ImportId\")REFERENCES\"tb_import\"(\"ImportId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importdetail_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importdetail_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_importdetail\"(\"ImportDetailId\",\"ImportId\",\"ProductId\",\"Price\",\"Count\",\"OriginalTotalPrice\",\"TotalPrice\",\"PriceMode\",\"SalePrice\",\"OriginalSalePrice\",\"State\",\"AdminId\",\"DeviceId\",\"Mode\",\"PrintCount\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"ImportDetailId\",\"ImportId\",\"ProductId\",\"Price\",\"Count\",\"OriginalTotalPrice\",\"TotalPrice\",\"PriceMode\",\"SalePrice\",\"OriginalSalePrice\",\"State\",\"AdminId\",\"DeviceId\",\"Mode\",\"PrintCount\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_importdetail_old_20200206\";CREATE INDEX\"main\".\"tb_importdetail_addtime\"ON\"tb_importdetail\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_importdetail_adminid\"ON\"tb_importdetail\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_importdetail_deviceId\"ON\"tb_importdetail\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_importdetail_importid\"ON\"tb_importdetail\"(\"ImportId\"ASC);CREATE INDEX\"main\".\"tb_importdetail_mode\"ON\"tb_importdetail\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_importdetail_productid\"ON\"tb_importdetail\"(\"ProductId\"ASC);CREATE INDEX\"main\".\"tb_importdetail_state\"ON\"tb_importdetail\"(\"State\"ASC);CREATE INDEX\"main\".\"tb_importdetail_updatetime\"ON\"tb_importdetail\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_importpay\"RENAME TO\"_tb_importpay_old_20200206\";DROP INDEX\"main\".\"importpay_addTime\";DROP INDEX\"main\".\"importpay_adminId\";DROP INDEX\"main\".\"importpay_balanceId\";DROP INDEX\"main\".\"importpay_deviceId\";DROP INDEX\"main\".\"importpay_importId\";DROP INDEX\"main\".\"importpay_mode\";DROP INDEX\"main\".\"importpay_state\";DROP INDEX\"main\".\"importpay_supplierId\";DROP INDEX\"main\".\"importpay_updateTime\";CREATE TABLE\"main\".\"tb_importpay\"(\"ImportPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ImportId\"INTEGER NOT NULL,\"BalanceId\"INTEGER,\"SupplierId\"INTEGER,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"Rate\"REAL NOT NULL DEFAULT 100,\"RemovePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_importpay_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_importpay_importId\"FOREIGN KEY(\"ImportId\")REFERENCES\"tb_import\"(\"ImportId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_importpay\"(\"ImportPayId\",\"ImportId\",\"BalanceId\",\"SupplierId\",\"OriginalPrice\",\"Rate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"State\",\"Remark\",\"AddTime\",\"UpdateTime\")SELECT\"ImportPayId\",\"ImportId\",\"BalanceId\",\"SupplierId\",\"OriginalPrice\",\"Rate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"State\",\"Remark\",\"AddTime\",\"UpdateTime\"FROM\"_tb_importpay_old_20200206\";CREATE INDEX\"main\".\"importpay_addTime\"ON\"tb_importpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"importpay_adminId\"ON\"tb_importpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"importpay_balanceId\"ON\"tb_importpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"importpay_deviceId\"ON\"tb_importpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"importpay_importId\"ON\"tb_importpay\"(\"ImportId\"ASC);CREATE INDEX\"main\".\"importpay_mode\"ON\"tb_importpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"importpay_state\"ON\"tb_importpay\"(\"State\"ASC);CREATE INDEX\"main\".\"importpay_supplierId\"ON\"tb_importpay\"(\"SupplierId\"ASC);CREATE INDEX\"main\".\"importpay_updateTime\"ON\"tb_importpay\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_log\"RENAME TO\"_tb_log_old_20200206\";DROP INDEX\"main\".\"tb_log_addtime\";DROP INDEX\"main\".\"tb_log_adminId\";DROP INDEX\"main\".\"tb_log_deviceId\";DROP INDEX\"main\".\"tb_log_index_BalanceType\";DROP INDEX\"main\".\"tb_log_index_IsBalanceChange\";DROP INDEX\"main\".\"tb_log_index_operateId\";DROP INDEX\"main\".\"tb_log_index_operateName\";CREATE TABLE\"main\".\"tb_log\"(\"LogId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"OperateId\"INTEGER NOT NULL,\"OperateSubId\"INTEGER,\"OperateName\"TEXT(30)NOT NULL,\"BalanceType\"INTEGER NOT NULL,\"IsBalanceChange\"INTEGER NOT NULL,\"Balance\"TEXT,\"Other\"TEXT(50),\"Model\"TEXT,\"AdminId\"INTEGER,\"DeviceId\"INTEGER,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL);INSERT INTO\"main\".\"tb_log\"(\"LogId\",\"OperateId\",\"OperateSubId\",\"OperateName\",\"BalanceType\",\"IsBalanceChange\",\"Balance\",\"Other\",\"Model\",\"AdminId\",\"DeviceId\",\"Remark\",\"AddTime\")SELECT\"LogId\",\"OperateId\",\"OperateSubId\",\"OperateName\",\"BalanceType\",\"IsBalanceChange\",\"Balance\",\"Other\",\"Model\",\"AdminId\",\"DeviceId\",\"Remark\",\"AddTime\"FROM\"_tb_log_old_20200206\";CREATE INDEX\"main\".\"tb_log_addtime\"ON\"tb_log\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_log_adminId\"ON\"tb_log\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_log_deviceId\"ON\"tb_log\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_log_index_IsBalanceChange\"ON\"tb_log\"(\"IsBalanceChange\"ASC);CREATE INDEX\"main\".\"tb_log_index_BalanceType\"ON\"tb_log\"(\"BalanceType\"ASC);CREATE INDEX\"main\".\"tb_log_index_operateId\"ON\"tb_log\"(\"OperateId\"ASC);CREATE INDEX\"main\".\"tb_log_index_operateName\"ON\"tb_log\"(\"OperateName\"ASC);ALTER TABLE\"main\".\"tb_member\"RENAME TO\"_tb_member_old_20200206\";DROP INDEX\"main\".\"tb_member_addTime\";DROP INDEX\"main\".\"tb_member_adminID\";DROP INDEX\"main\".\"tb_member_CardNo\";DROP INDEX\"main\".\"tb_member_expiredTime\";DROP INDEX\"main\".\"tb_member_lang\";DROP INDEX\"main\".\"tb_member_memberName\";DROP INDEX\"main\".\"tb_member_memberNo\";DROP INDEX\"main\".\"tb_member_mobile\";DROP INDEX\"main\".\"tb_member_password\";DROP INDEX\"main\".\"tb_member_phone\";DROP INDEX\"main\".\"tb_member_updateTime\";CREATE TABLE\"main\".\"tb_member\"(\"MemberId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"MemberNo\"TEXT(50)NOT NULL,\"CardNo\"TEXT(50)DEFAULT NULL,\"Password\"TEXT(32),\"MemberNameUG\"TEXT(50)NOT NULL,\"MemberNameZH\"TEXT(50)NOT NULL,\"MemberNameEN\"TEXT(50)NOT NULL,\"Lang\"INTEGER NOT NULL,\"Sex\"INTEGER NOT NULL,\"Occupation\"INTEGER NOT NULL,\"Mobile\"TEXT(30),\"Phone\"TEXT(30),\"ImageName\"TEXT(30),\"IDNumber\"TEXT(30),\"AddressUG\"TEXT(300),\"AddressZH\"TEXT(300),\"AddressEN\"TEXT(300),\"AddressLocation\"TEXT(50),\"AdminId\"INTEGER,\"OfferRate\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"MinBalancePrice\"REAL NOT NULL,\"MaxBalancePrice\"REAL NOT NULL,\"SpendPrice\"REAL NOT NULL,\"FavorablePrice\"REAL NOT NULL,\"ExpiredTime\"INTEGER NOT NULL,\"IsAllowBorrow\"INTEGER NOT NULL DEFAULT 0,\"Order\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT,CONSTRAINT\"fk_member_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_member\"(\"MemberId\",\"MemberNo\",\"CardNo\",\"Password\",\"MemberNameUG\",\"MemberNameZH\",\"MemberNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"Phone\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"AddressLocation\",\"AdminId\",\"OfferRate\",\"BalancePrice\",\"MinBalancePrice\",\"MaxBalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"ExpiredTime\",\"IsAllowBorrow\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"MemberId\",\"MemberNo\",\"CardNo\",\"Password\",\"MemberNameUG\",\"MemberNameZH\",\"MemberNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"Phone\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"AddressLocation\",\"AdminId\",\"OfferRate\",\"BalancePrice\",\"MinBalancePrice\",\"MaxBalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"ExpiredTime\",\"IsAllowBorrow\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_member_old_20200206\";CREATE INDEX\"main\".\"tb_member_CardNo\"ON\"tb_member\"(\"CardNo\"ASC);CREATE INDEX\"main\".\"tb_member_addTime\"ON\"tb_member\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_member_adminID\"ON\"tb_member\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_member_expiredTime\"ON\"tb_member\"(\"ExpiredTime\"ASC);CREATE INDEX\"main\".\"tb_member_lang\"ON\"tb_member\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_member_memberName\"ON\"tb_member\"(\"MemberNameUG\"ASC,\"MemberNameZH\"ASC,\"MemberNameEN\"ASC);CREATE UNIQUE INDEX\"main\".\"tb_member_memberNo\"ON\"tb_member\"(\"MemberNo\"ASC);CREATE INDEX\"main\".\"tb_member_mobile\"ON\"tb_member\"(\"Mobile\"ASC);CREATE INDEX\"main\".\"tb_member_password\"ON\"tb_member\"(\"Password\"ASC);CREATE INDEX\"main\".\"tb_member_phone\"ON\"tb_member\"(\"Phone\"ASC);CREATE INDEX\"main\".\"tb_member_updateTime\"ON\"tb_member\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_memberpay\"RENAME TO\"_tb_memberpay_old_20200206\";DROP INDEX\"main\".\"tb_memberPay_isPaybyCard\";DROP INDEX\"main\".\"tb_memberpay_addTime\";DROP INDEX\"main\".\"tb_memberpay_adminId\";DROP INDEX\"main\".\"tb_memberpay_balanceId\";DROP INDEX\"main\".\"tb_memberpay_deviceId\";DROP INDEX\"main\".\"tb_memberpay_memberId\";DROP INDEX\"main\".\"tb_memberpay_mode\";CREATE TABLE\"main\".\"tb_memberpay\"(\"MemberPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"MemberId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 100,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_memberpay_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_memberpay\"(\"MemberPayId\",\"MemberId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"MemberPayId\",\"MemberId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_memberpay_old_20200206\";CREATE INDEX\"main\".\"tb_memberpay_addTime\"ON\"tb_memberpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_memberpay_adminId\"ON\"tb_memberpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_balanceId\"ON\"tb_memberpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_deviceId\"ON\"tb_memberpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_memberId\"ON\"tb_memberpay\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_mode\"ON\"tb_memberpay\"(\"Mode\"ASC);ALTER TABLE\"main\".\"tb_order\"RENAME TO\"_tb_order_old_20200206\";DROP INDEX\"main\".\"tb_order_Ispack\";DROP INDEX\"main\".\"tb_order_addtime\";DROP INDEX\"main\".\"tb_order_adminId\";DROP INDEX\"main\".\"tb_order_deviceId\";DROP INDEX\"main\".\"tb_order_endtime\";DROP INDEX\"main\".\"tb_order_finishAdminId\";DROP INDEX\"main\".\"tb_order_finishDeviceId\";DROP INDEX\"main\".\"tb_order_finishtime\";DROP INDEX\"main\".\"tb_order_lang\";DROP INDEX\"main\".\"tb_order_memberId\";DROP INDEX\"main\".\"tb_order_mode\";DROP INDEX\"main\".\"tb_order_personCount\";DROP INDEX\"main\".\"tb_order_recheckedcount\";DROP INDEX\"main\".\"tb_order_roomid\";DROP INDEX\"main\".\"tb_order_starttime\";DROP INDEX\"main\".\"tb_order_state\";DROP INDEX\"main\".\"tb_order_updateTime\";CREATE TABLE\"main\".\"tb_order\"(\"OrderId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"RoomId\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"PaidPrice\"REAL NOT NULL,\"MemberPaidPrice\"REAL NOT NULL,\"TotalPaidPrice\"REAL NOT NULL,\"BorrowPrice\"REAL NOT NULL,\"KeepPrice\"REAL NOT NULL,\"Lang\"INTEGER NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"MemberId\"INTEGER,\"Mode\"INTEGER NOT NULL,\"Request\"TEXT(100),\"IsPack\"INTEGER NOT NULL,\"PersonCount\"INTEGER NOT NULL,\"RoomPrice\"REAL NOT NULL,\"IsPayByTime\"INTEGER NOT NULL DEFAULT 0,\"IsFreeRoomPrice\"INTEGER NOT NULL DEFAULT 0,\"IsAutoPay\"INTEGER NOT NULL,\"RoomPriceCalcTime\"INTEGER NOT NULL,\"StartTime\"INTEGER,\"EndTime\"INTEGER,\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"ReCheckedCount\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"FinishAdminId\"INTEGER NOT NULL,\"FinishDeviceId\"INTEGER NOT NULL,\"FinishTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_order_roomId\"FOREIGN KEY(\"RoomId\")REFERENCES\"tb_room\"(\"RoomId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_order_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_order_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_order_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_order_finishAdminId\"FOREIGN KEY(\"FinishAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_order_finishDeviceId\"FOREIGN KEY(\"FinishDeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_order\"(\"OrderId\",\"RoomId\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"MemberPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"Mode\",\"Request\",\"IsPack\",\"PersonCount\",\"RoomPrice\",\"IsPayByTime\",\"IsFreeRoomPrice\",\"IsAutoPay\",\"RoomPriceCalcTime\",\"StartTime\",\"EndTime\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"Remark\")SELECT\"OrderId\",\"RoomId\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"MemberPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"Mode\",\"Request\",\"IsPack\",\"PersonCount\",\"RoomPrice\",\"IsPayByTime\",\"IsFreeRoomPrice\",\"IsAutoPay\",\"RoomPriceCalcTime\",\"StartTime\",\"EndTime\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"Remark\"FROM\"_tb_order_old_20200206\";CREATE INDEX\"main\".\"tb_order_Ispack\"ON\"tb_order\"(\"IsPack\"ASC);CREATE INDEX\"main\".\"tb_order_addtime\"ON\"tb_order\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_order_adminId\"ON\"tb_order\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_order_deviceId\"ON\"tb_order\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_order_endtime\"ON\"tb_order\"(\"EndTime\"ASC);CREATE INDEX\"main\".\"tb_order_finishAdminId\"ON\"tb_order\"(\"FinishAdminId\"ASC);CREATE INDEX\"main\".\"tb_order_finishDeviceId\"ON\"tb_order\"(\"FinishDeviceId\"ASC);CREATE INDEX\"main\".\"tb_order_finishtime\"ON\"tb_order\"(\"FinishTime\"ASC);CREATE INDEX\"main\".\"tb_order_lang\"ON\"tb_order\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_order_memberId\"ON\"tb_order\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_order_mode\"ON\"tb_order\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_order_personCount\"ON\"tb_order\"(\"PersonCount\"ASC);CREATE INDEX\"main\".\"tb_order_recheckedcount\"ON\"tb_order\"(\"ReCheckedCount\"ASC);CREATE INDEX\"main\".\"tb_order_roomid\"ON\"tb_order\"(\"RoomId\"ASC);CREATE INDEX\"main\".\"tb_order_starttime\"ON\"tb_order\"(\"StartTime\"ASC);CREATE INDEX\"main\".\"tb_order_state\"ON\"tb_order\"(\"State\"ASC);CREATE INDEX\"main\".\"tb_order_updateTime\"ON\"tb_order\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_orderdetail\"RENAME TO\"_tb_orderdetail_old_20200206\";DROP INDEX\"main\".\"orderdetail_addTime\";DROP INDEX\"main\".\"orderdetail_adminId\";DROP INDEX\"main\".\"orderdetail_confirmAdminId\";DROP INDEX\"main\".\"orderdetail_confirmDeviceId\";DROP INDEX\"main\".\"orderdetail_confirmTime\";DROP INDEX\"main\".\"orderdetail_deviceId\";DROP INDEX\"main\".\"orderdetail_Ispack\";DROP INDEX\"main\".\"orderdetail_mode\";DROP INDEX\"main\".\"orderdetail_orderid\";DROP INDEX\"main\".\"orderdetail_productId\";DROP INDEX\"main\".\"orderdetail_state\";DROP INDEX\"main\".\"orderdetail_updateTime\";CREATE TABLE\"main\".\"tb_orderdetail\"(\"OrderDetailId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"OrderId\"INTEGER NOT NULL,\"ProductId\"INTEGER NOT NULL,\"Price\"REAL NOT NULL,\"Count\"REAL NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"TotalCostPrice\"REAL NOT NULL DEFAULT 0,\"State\"INTEGER NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsPack\"INTEGER NOT NULL,\"Request\"TEXT(100),\"ConfirmAdminId\"INTEGER,\"ConfirmDeviceId\"INTEGER,\"ConfirmTime\"INTEGER,\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_orderdetail_orderid\"FOREIGN KEY(\"OrderId\")REFERENCES\"tb_order\"(\"OrderId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderdetail_productId\"FOREIGN KEY(\"ProductId\")REFERENCES\"tb_product\"(\"ProductId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderdetail_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderdetail_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderdetail_confirmAdminId\"FOREIGN KEY(\"ConfirmAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderdetail_confirmDeviceId\"FOREIGN KEY(\"ConfirmDeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_orderdetail\"(\"OrderDetailId\",\"OrderId\",\"ProductId\",\"Price\",\"Count\",\"OriginalTotalPrice\",\"TotalPrice\",\"TotalCostPrice\",\"State\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsPack\",\"Request\",\"ConfirmAdminId\",\"ConfirmDeviceId\",\"ConfirmTime\",\"PrintCount\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"OrderDetailId\",\"OrderId\",\"ProductId\",\"Price\",\"Count\",\"OriginalTotalPrice\",\"TotalPrice\",\"TotalCostPrice\",\"State\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsPack\",\"Request\",\"ConfirmAdminId\",\"ConfirmDeviceId\",\"ConfirmTime\",\"PrintCount\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_orderdetail_old_20200206\";CREATE INDEX\"main\".\"orderdetail_Ispack\"ON\"tb_orderdetail\"(\"IsPack\"ASC);CREATE INDEX\"main\".\"orderdetail_addTime\"ON\"tb_orderdetail\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"orderdetail_adminId\"ON\"tb_orderdetail\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"orderdetail_confirmAdminId\"ON\"tb_orderdetail\"(\"ConfirmAdminId\"ASC);CREATE INDEX\"main\".\"orderdetail_confirmDeviceId\"ON\"tb_orderdetail\"(\"ConfirmDeviceId\"ASC);CREATE INDEX\"main\".\"orderdetail_confirmTime\"ON\"tb_orderdetail\"(\"ConfirmTime\"ASC);CREATE INDEX\"main\".\"orderdetail_deviceId\"ON\"tb_orderdetail\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"orderdetail_mode\"ON\"tb_orderdetail\"(\"Mode\"ASC);CREATE INDEX\"main\".\"orderdetail_orderid\"ON\"tb_orderdetail\"(\"OrderId\"ASC);CREATE INDEX\"main\".\"orderdetail_productId\"ON\"tb_orderdetail\"(\"ProductId\"ASC);CREATE INDEX\"main\".\"orderdetail_state\"ON\"tb_orderdetail\"(\"State\"ASC);CREATE INDEX\"main\".\"orderdetail_updateTime\"ON\"tb_orderdetail\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_orderpay\"RENAME TO\"_tb_orderpay_old_20200206\";DROP INDEX\"main\".\"orderpay_addTime\";DROP INDEX\"main\".\"orderpay_adminId\";DROP INDEX\"main\".\"orderpay_balanceId\";DROP INDEX\"main\".\"orderpay_deviceId\";DROP INDEX\"main\".\"orderpay_memberId\";DROP INDEX\"main\".\"orderpay_mode\";DROP INDEX\"main\".\"orderpay_orderId\";DROP INDEX\"main\".\"orderpay_state\";DROP INDEX\"main\".\"orderpay_updateTime\";CREATE TABLE\"main\".\"tb_orderpay\"(\"OrderPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"OrderId\"INTEGER NOT NULL,\"BalanceId\"INTEGER,\"MemberId\"INTEGER,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"Rate\"REAL NOT NULL DEFAULT 100,\"RemovePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_orderpay_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_orderpay_orderId\"FOREIGN KEY(\"OrderId\")REFERENCES\"tb_order\"(\"OrderId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_orderpay\"(\"OrderPayId\",\"OrderId\",\"BalanceId\",\"MemberId\",\"OriginalPrice\",\"Rate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"State\",\"Remark\",\"AddTime\",\"UpdateTime\")SELECT\"OrderPayId\",\"OrderId\",\"BalanceId\",\"MemberId\",\"OriginalPrice\",\"Rate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"State\",\"Remark\",\"AddTime\",\"UpdateTime\"FROM\"_tb_orderpay_old_20200206\";CREATE INDEX\"main\".\"orderpay_addTime\"ON\"tb_orderpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"orderpay_adminId\"ON\"tb_orderpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"orderpay_balanceId\"ON\"tb_orderpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"orderpay_deviceId\"ON\"tb_orderpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"orderpay_memberId\"ON\"tb_orderpay\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"orderpay_mode\"ON\"tb_orderpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"orderpay_orderId\"ON\"tb_orderpay\"(\"OrderId\"ASC);CREATE INDEX\"main\".\"orderpay_state\"ON\"tb_orderpay\"(\"State\"ASC);CREATE INDEX\"main\".\"orderpay_updateTime\"ON\"tb_orderpay\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_returnpay\"RENAME TO\"_tb_returnpay_old_20200206\";DROP INDEX\"main\".\"returnpay_addTime\";DROP INDEX\"main\".\"returnpay_adminId\";DROP INDEX\"main\".\"returnpay_balanceId\";DROP INDEX\"main\".\"returnpay_deviceId\";DROP INDEX\"main\".\"returnpay_mode\";DROP INDEX\"main\".\"returnpay_returnId\";DROP INDEX\"main\".\"returnpay_state\";DROP INDEX\"main\".\"returnpay_supplierId\";DROP INDEX\"main\".\"returnpay_updateTime\";CREATE TABLE\"main\".\"tb_returnpay\"(\"ReturnPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ReturnId\"INTEGER NOT NULL,\"BalanceId\"INTEGER,\"SupplierId\"INTEGER,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"Rate\"REAL NOT NULL DEFAULT 100,\"RemovePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_returnpay_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_returnpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_returnpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_returnpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_returnpay_returnId\"FOREIGN KEY(\"ReturnId\")REFERENCES\"tb_return\"(\"ReturnId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_returnpay\"(\"ReturnPayId\",\"ReturnId\",\"BalanceId\",\"SupplierId\",\"OriginalPrice\",\"Rate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"State\",\"Remark\",\"AddTime\",\"UpdateTime\")SELECT\"ReturnPayId\",\"ReturnId\",\"BalanceId\",\"SupplierId\",\"OriginalPrice\",\"Rate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"State\",\"Remark\",\"AddTime\",\"UpdateTime\"FROM\"_tb_returnpay_old_20200206\";CREATE INDEX\"main\".\"returnpay_addTime\"ON\"tb_returnpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"returnpay_adminId\"ON\"tb_returnpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"returnpay_balanceId\"ON\"tb_returnpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"returnpay_deviceId\"ON\"tb_returnpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"returnpay_mode\"ON\"tb_returnpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"returnpay_returnId\"ON\"tb_returnpay\"(\"ReturnId\"ASC);CREATE INDEX\"main\".\"returnpay_state\"ON\"tb_returnpay\"(\"State\"ASC);CREATE INDEX\"main\".\"returnpay_supplierId\"ON\"tb_returnpay\"(\"SupplierId\"ASC);CREATE INDEX\"main\".\"returnpay_updateTime\"ON\"tb_returnpay\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_return\"RENAME TO\"_tb_return_old_20200206\";DROP INDEX\"main\".\"tb_return_addTime\";DROP INDEX\"main\".\"tb_return_adminId\";DROP INDEX\"main\".\"tb_return_deviceId\";DROP INDEX\"main\".\"tb_return_finishAdminId\";DROP INDEX\"main\".\"tb_return_finishDeviceId\";DROP INDEX\"main\".\"tb_return_finishTime\";DROP INDEX\"main\".\"tb_return_lang\";DROP INDEX\"main\".\"tb_return_memberId\";DROP INDEX\"main\".\"tb_return_mode\";DROP INDEX\"main\".\"tb_return_name\";DROP INDEX\"main\".\"tb_return_phone\";DROP INDEX\"main\".\"tb_return_recheckedcount\";DROP INDEX\"main\".\"tb_return_returnType\";DROP INDEX\"main\".\"tb_return_sendTime\";DROP INDEX\"main\".\"tb_return_state\";DROP INDEX\"main\".\"tb_return_supplierId\";DROP INDEX\"main\".\"tb_return_updateTime\";CREATE TABLE\"main\".\"tb_return\"(\"ReturnId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ReturnType\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"SMPaidPrice\"REAL NOT NULL,\"PaidPrice\"REAL NOT NULL,\"TotalPaidPrice\"REAL NOT NULL,\"BorrowPrice\"REAL NOT NULL,\"KeepPrice\"REAL NOT NULL,\"Lang\"INTEGER NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"MemberId\"INTEGER,\"SupplierId\"INTEGER,\"Mode\"INTEGER NOT NULL,\"NameUG\"TEXT(50),\"NameZH\"TEXT(50),\"NameEN\"TEXT(50),\"Request\"TEXT(100),\"Phone\"TEXT(50),\"AddressUG\"TEXT(100),\"AddressZH\"TEXT(100),\"AddressEN\"TEXT(100),\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"ReCheckedCount\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"FinishAdminId\"INTEGER NOT NULL,\"FinishDeviceId\"INTEGER NOT NULL,\"FinishTime\"INTEGER,\"SendAdminId\"INTEGER,\"SendTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_return_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_return_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_return_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_return_sendadminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_return_finishAdminId\"FOREIGN KEY(\"FinishAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_return_finishDeviceId\"FOREIGN KEY(\"FinishDeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_return_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_return\"(\"ReturnId\",\"ReturnType\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"SMPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"SupplierId\",\"Mode\",\"NameUG\",\"NameZH\",\"NameEN\",\"Request\",\"Phone\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"SendAdminId\",\"SendTime\",\"Remark\")SELECT\"ReturnId\",\"ReturnType\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"SMPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"SupplierId\",\"Mode\",\"NameUG\",\"NameZH\",\"NameEN\",\"Request\",\"Phone\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"SendAdminId\",\"SendTime\",\"Remark\"FROM\"_tb_return_old_20200206\";CREATE INDEX\"main\".\"tb_return_addTime\"ON\"tb_return\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_return_adminId\"ON\"tb_return\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_return_deviceId\"ON\"tb_return\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_return_finishAdminId\"ON\"tb_return\"(\"FinishAdminId\"ASC);CREATE INDEX\"main\".\"tb_return_finishDeviceId\"ON\"tb_return\"(\"FinishDeviceId\"ASC);CREATE INDEX\"main\".\"tb_return_finishTime\"ON\"tb_return\"(\"FinishTime\"ASC);CREATE INDEX\"main\".\"tb_return_lang\"ON\"tb_return\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_return_memberId\"ON\"tb_return\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_return_mode\"ON\"tb_return\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_return_name\"ON\"tb_return\"(\"NameUG\"ASC,\"NameZH\"ASC,\"NameEN\"ASC);CREATE INDEX\"main\".\"tb_return_phone\"ON\"tb_return\"(\"Phone\"ASC);CREATE INDEX\"main\".\"tb_return_recheckedcount\"ON\"tb_return\"(\"ReCheckedCount\"ASC);CREATE INDEX\"main\".\"tb_return_returnType\"ON\"tb_return\"(\"ReturnType\"ASC);CREATE INDEX\"main\".\"tb_return_sendTime\"ON\"tb_return\"(\"SendTime\"ASC);CREATE INDEX\"main\".\"tb_return_state\"ON\"tb_return\"(\"State\"ASC);CREATE INDEX\"main\".\"tb_return_supplierId\"ON\"tb_return\"(\"SupplierId\"ASC);CREATE INDEX\"main\".\"tb_return_updateTime\"ON\"tb_return\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_supplierpay\"RENAME TO\"_tb_supplierpay_old_20200206\";DROP INDEX\"main\".\"tb_supplierpay_addTime\";DROP INDEX\"main\".\"tb_supplierpay_adminId\";DROP INDEX\"main\".\"tb_supplierpay_balanceId\";DROP INDEX\"main\".\"tb_supplierpay_deviceId\";DROP INDEX\"main\".\"tb_supplierPay_isPaybyCard\";DROP INDEX\"main\".\"tb_supplierpay_mode\";DROP INDEX\"main\".\"tb_supplierpay_supplierId\";CREATE TABLE\"main\".\"tb_supplierpay\"(\"SupplierPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"SupplierId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 100,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_supplierpay_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_supplierpay\"(\"SupplierPayId\",\"SupplierId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"SupplierPayId\",\"SupplierId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_supplierpay_old_20200206\";CREATE INDEX\"main\".\"tb_supplierpay_addTime\"ON\"tb_supplierpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_adminId\"ON\"tb_supplierpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_balanceId\"ON\"tb_supplierpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_deviceId\"ON\"tb_supplierpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_mode\"ON\"tb_supplierpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_supplierId\"ON\"tb_supplierpay\"(\"SupplierId\"ASC);ALTER TABLE\"main\".\"tb_supplier\"RENAME TO\"_tb_supplier_old_20200206\";DROP INDEX\"main\".\"tb_supplier_addTime\";DROP INDEX\"main\".\"tb_supplier_adminID\";DROP INDEX\"main\".\"tb_supplier_CardNo\";DROP INDEX\"main\".\"tb_supplier_expiredTime\";DROP INDEX\"main\".\"tb_supplier_lang\";DROP INDEX\"main\".\"tb_supplier_memberName\";DROP INDEX\"main\".\"tb_supplier_memberNo\";DROP INDEX\"main\".\"tb_supplier_mobile\";DROP INDEX\"main\".\"tb_supplier_password\";DROP INDEX\"main\".\"tb_supplier_phone\";DROP INDEX\"main\".\"tb_supplier_updateTime\";CREATE TABLE\"main\".\"tb_supplier\"(\"SupplierId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"SupplierNo\"TEXT(50)NOT NULL,\"CardNo\"TEXT(50)DEFAULT NULL,\"Password\"TEXT(32),\"SupplierNameUG\"TEXT(50)NOT NULL,\"SupplierNameZH\"TEXT(50)NOT NULL,\"SupplierNameEN\"TEXT(50)NOT NULL,\"Lang\"INTEGER NOT NULL,\"Sex\"INTEGER NOT NULL,\"Occupation\"INTEGER NOT NULL,\"Mobile\"TEXT(30),\"Phone\"TEXT(30),\"ImageName\"TEXT(30),\"IDNumber\"TEXT(30),\"AddressUG\"TEXT(300),\"AddressZH\"TEXT(300),\"AddressEN\"TEXT(300),\"AddressLocation\"TEXT(50),\"AdminId\"INTEGER,\"OfferRate\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"MinBalancePrice\"REAL NOT NULL,\"MaxBalancePrice\"REAL NOT NULL,\"SpendPrice\"REAL NOT NULL,\"FavorablePrice\"REAL NOT NULL,\"ExpiredTime\"INTEGER NOT NULL,\"IsAllowBorrow\"INTEGER NOT NULL DEFAULT 0,\"Order\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT,CONSTRAINT\"fk_supplier_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_supplier\"(\"SupplierId\",\"SupplierNo\",\"CardNo\",\"Password\",\"SupplierNameUG\",\"SupplierNameZH\",\"SupplierNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"Phone\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"AddressLocation\",\"AdminId\",\"OfferRate\",\"BalancePrice\",\"MinBalancePrice\",\"MaxBalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"ExpiredTime\",\"IsAllowBorrow\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"SupplierId\",\"SupplierNo\",\"CardNo\",\"Password\",\"SupplierNameUG\",\"SupplierNameZH\",\"SupplierNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"Phone\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"AddressLocation\",\"AdminId\",\"OfferRate\",\"BalancePrice\",\"MinBalancePrice\",\"MaxBalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"ExpiredTime\",\"IsAllowBorrow\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_supplier_old_20200206\";CREATE INDEX\"main\".\"tb_supplier_CardNo\"ON\"tb_supplier\"(\"CardNo\"ASC);CREATE INDEX\"main\".\"tb_supplier_addTime\"ON\"tb_supplier\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_supplier_adminID\"ON\"tb_supplier\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_supplier_expiredTime\"ON\"tb_supplier\"(\"ExpiredTime\"ASC);CREATE INDEX\"main\".\"tb_supplier_lang\"ON\"tb_supplier\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_supplier_memberName\"ON\"tb_supplier\"(\"SupplierNameUG\"ASC,\"SupplierNameZH\"ASC,\"SupplierNameEN\"ASC);CREATE UNIQUE INDEX\"main\".\"tb_supplier_memberNo\"ON\"tb_supplier\"(\"SupplierNo\"ASC);CREATE INDEX\"main\".\"tb_supplier_mobile\"ON\"tb_supplier\"(\"Mobile\"ASC);CREATE INDEX\"main\".\"tb_supplier_password\"ON\"tb_supplier\"(\"Password\"ASC);CREATE INDEX\"main\".\"tb_supplier_phone\"ON\"tb_supplier\"(\"Phone\"ASC);CREATE INDEX\"main\".\"tb_supplier_updateTime\"ON\"tb_supplier\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_takeoutpay\"RENAME TO\"_tb_takeoutpay_old_20200206\";DROP INDEX\"main\".\"takeoutpay_addTime\";DROP INDEX\"main\".\"takeoutpay_adminId\";DROP INDEX\"main\".\"takeoutpay_balanceId\";DROP INDEX\"main\".\"takeoutpay_deviceId\";DROP INDEX\"main\".\"takeoutpay_memberId\";DROP INDEX\"main\".\"takeoutpay_mode\";DROP INDEX\"main\".\"takeoutpay_state\";DROP INDEX\"main\".\"takeoutpay_takeoutId\";DROP INDEX\"main\".\"takeoutpay_updateTime\";CREATE TABLE\"main\".\"tb_takeoutpay\"(\"TakeoutPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"TakeoutId\"INTEGER NOT NULL,\"BalanceId\"INTEGER,\"MemberId\"INTEGER,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"Rate\"REAL NOT NULL DEFAULT 100,\"RemovePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"State\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_takeoutpay_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutpay_TakeoutId\"FOREIGN KEY(\"TakeoutId\")REFERENCES\"tb_takeout\"(\"TakeoutId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_takeoutpay\"(\"TakeoutPayId\",\"TakeoutId\",\"BalanceId\",\"MemberId\",\"OriginalPrice\",\"Rate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"State\",\"Remark\",\"AddTime\",\"UpdateTime\")SELECT\"TakeoutPayId\",\"TakeoutId\",\"BalanceId\",\"MemberId\",\"OriginalPrice\",\"Rate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"State\",\"Remark\",\"AddTime\",\"UpdateTime\"FROM\"_tb_takeoutpay_old_20200206\";CREATE INDEX\"main\".\"takeoutpay_addTime\"ON\"tb_takeoutpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"takeoutpay_adminId\"ON\"tb_takeoutpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"takeoutpay_balanceId\"ON\"tb_takeoutpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"takeoutpay_deviceId\"ON\"tb_takeoutpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"takeoutpay_memberId\"ON\"tb_takeoutpay\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"takeoutpay_mode\"ON\"tb_takeoutpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"takeoutpay_state\"ON\"tb_takeoutpay\"(\"State\"ASC);CREATE INDEX\"main\".\"takeoutpay_takeoutId\"ON\"tb_takeoutpay\"(\"TakeoutId\"ASC);CREATE INDEX\"main\".\"takeoutpay_updateTime\"ON\"tb_takeoutpay\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_takeoutdetail\"RENAME TO\"_tb_takeoutdetail_old_20200206\";DROP INDEX\"main\".\"takeoutdetail_addTime\";DROP INDEX\"main\".\"takeoutdetail_adminId\";DROP INDEX\"main\".\"takeoutdetail_confirmAdminId\";DROP INDEX\"main\".\"takeoutdetail_confirmDeviceId\";DROP INDEX\"main\".\"takeoutdetail_deviceId\";DROP INDEX\"main\".\"takeoutdetail_IsPack\";DROP INDEX\"main\".\"takeoutdetail_mode\";DROP INDEX\"main\".\"takeoutdetail_productId\";DROP INDEX\"main\".\"takeoutdetail_serverProductId\";DROP INDEX\"main\".\"takeoutdetail_serverTakeoutDetaildId\";DROP INDEX\"main\".\"takeoutdetail_serverTakeoutDetailSessionId\";DROP INDEX\"main\".\"takeoutdetail_state\";DROP INDEX\"main\".\"takeoutdetail_takeoutId\";DROP INDEX\"main\".\"takeoutdetail_updateTime\";CREATE TABLE\"main\".\"tb_takeoutdetail\"(\"TakeoutDetailId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ServerTakeoutDetailId\"TEXT(50),\"ServerTakeoutDetailSessionId\"INTEGER,\"TakeoutId\"INTEGER NOT NULL,\"ProductId\"INTEGER,\"ServerProductId\"INTEGER,\"Price\"REAL NOT NULL,\"Count\"REAL NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"TotalCostPrice\"REAL NOT NULL DEFAULT 0,\"State\"INTEGER NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"Request\"TEXT(100),\"IsPack\"INTEGER NOT NULL,\"ConfirmAdminId\"INTEGER,\"ConfirmDeviceId\"INTEGER,\"ConfirmTime\"INTEGER,\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_takeoutdetail_takeoutId\"FOREIGN KEY(\"TakeoutId\")REFERENCES\"tb_takeout\"(\"TakeoutId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutdetail_productId\"FOREIGN KEY(\"ProductId\")REFERENCES\"tb_product\"(\"ProductId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutdetail_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutdetail_device\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutdetail_confirmAdminId\"FOREIGN KEY(\"ConfirmAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeoutdetail_confirmDeviceId\"FOREIGN KEY(\"ConfirmDeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_takeoutdetail\"(\"TakeoutDetailId\",\"ServerTakeoutDetailId\",\"ServerTakeoutDetailSessionId\",\"TakeoutId\",\"ProductId\",\"ServerProductId\",\"Price\",\"Count\",\"OriginalTotalPrice\",\"TotalPrice\",\"TotalCostPrice\",\"State\",\"AdminId\",\"DeviceId\",\"Mode\",\"Request\",\"IsPack\",\"ConfirmAdminId\",\"ConfirmDeviceId\",\"ConfirmTime\",\"PrintCount\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"TakeoutDetailId\",\"ServerTakeoutDetailId\",\"ServerTakeoutDetailSessionId\",\"TakeoutId\",\"ProductId\",\"ServerProductId\",\"Price\",\"Count\",\"OriginalTotalPrice\",\"TotalPrice\",\"TotalCostPrice\",\"State\",\"AdminId\",\"DeviceId\",\"Mode\",\"Request\",\"IsPack\",\"ConfirmAdminId\",\"ConfirmDeviceId\",\"ConfirmTime\",\"PrintCount\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_takeoutdetail_old_20200206\";CREATE INDEX\"main\".\"takeoutdetail_IsPack\"ON\"tb_takeoutdetail\"(\"IsPack\"ASC);CREATE INDEX\"main\".\"takeoutdetail_addTime\"ON\"tb_takeoutdetail\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"takeoutdetail_adminId\"ON\"tb_takeoutdetail\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"takeoutdetail_confirmAdminId\"ON\"tb_takeoutdetail\"(\"ConfirmAdminId\"ASC);CREATE INDEX\"main\".\"takeoutdetail_confirmDeviceId\"ON\"tb_takeoutdetail\"(\"ConfirmDeviceId\"ASC);CREATE INDEX\"main\".\"takeoutdetail_deviceId\"ON\"tb_takeoutdetail\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"takeoutdetail_mode\"ON\"tb_takeoutdetail\"(\"Mode\"ASC);CREATE INDEX\"main\".\"takeoutdetail_productId\"ON\"tb_takeoutdetail\"(\"ProductId\"ASC);CREATE INDEX\"main\".\"takeoutdetail_serverProductId\"ON\"tb_takeoutdetail\"(\"ServerProductId\"ASC);CREATE INDEX\"main\".\"takeoutdetail_serverTakeoutDetailSessionId\"ON\"tb_takeoutdetail\"(\"ServerTakeoutDetailSessionId\"ASC);CREATE INDEX\"main\".\"takeoutdetail_serverTakeoutDetaildId\"ON\"tb_takeoutdetail\"(\"ServerTakeoutDetailId\"ASC);CREATE INDEX\"main\".\"takeoutdetail_state\"ON\"tb_takeoutdetail\"(\"State\"ASC);CREATE INDEX\"main\".\"takeoutdetail_takeoutId\"ON\"tb_takeoutdetail\"(\"TakeoutId\"ASC);CREATE INDEX\"main\".\"takeoutdetail_updateTime\"ON\"tb_takeoutdetail\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_takeout\"RENAME TO\"_tb_takeout_old_20200206\";DROP INDEX\"main\".\"tb_takeout_addTime\";DROP INDEX\"main\".\"tb_takeout_adminId\";DROP INDEX\"main\".\"tb_takeout_deviceId\";DROP INDEX\"main\".\"tb_takeout_finishAdminId\";DROP INDEX\"main\".\"tb_takeout_finishDeviceId\";DROP INDEX\"main\".\"tb_takeout_finishTime\";DROP INDEX\"main\".\"tb_takeout_ispack\";DROP INDEX\"main\".\"tb_takeout_lang\";DROP INDEX\"main\".\"tb_takeout_memberId\";DROP INDEX\"main\".\"tb_takeout_mode\";DROP INDEX\"main\".\"tb_takeout_name\";DROP INDEX\"main\".\"tb_takeout_personCount\";DROP INDEX\"main\".\"tb_takeout_phone\";DROP INDEX\"main\".\"tb_takeout_recheckedcount\";DROP INDEX\"main\".\"tb_takeout_sendTime\";DROP INDEX\"main\".\"tb_takeout_serverTakeoutSessionId\";DROP INDEX\"main\".\"tb_takeout_serverTokenId\";DROP INDEX\"main\".\"tb_takeout_state\";DROP INDEX\"main\".\"tb_takeout_updateTime\";CREATE TABLE\"main\".\"tb_takeout\"(\"TakeoutId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ServerTokenId\"TEXT(50),\"ServerTakeoutId\"TEXT(50),\"ServerTakeoutSessionId\"TEXT(50),\"State\"INTEGER NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"MemberPaidPrice\"REAL NOT NULL,\"PaidPrice\"REAL NOT NULL,\"TotalPaidPrice\"REAL NOT NULL,\"BorrowPrice\"REAL NOT NULL,\"KeepPrice\"REAL NOT NULL,\"Lang\"INTEGER NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"MemberId\"INTEGER,\"Mode\"INTEGER NOT NULL,\"IsPack\"INTEGER NOT NULL,\"PersonCount\"INTEGER NOT NULL,\"NameUG\"TEXT(50),\"NameZH\"TEXT(50),\"NameEN\"TEXT(50),\"Request\"TEXT(100),\"Phone\"TEXT(50),\"AddressUG\"TEXT(100),\"AddressZH\"TEXT(100),\"AddressEN\"TEXT(100),\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"ReCheckedCount\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"FinishAdminId\"INTEGER NOT NULL,\"FinishDeviceId\"INTEGER NOT NULL,\"FinishTime\"INTEGER,\"SendAdminId\"INTEGER,\"SendTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_takeout_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_sendadminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_finishAdminId\"FOREIGN KEY(\"FinishAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_finishDeviceId\"FOREIGN KEY(\"FinishDeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_takeout\"(\"TakeoutId\",\"ServerTokenId\",\"ServerTakeoutId\",\"ServerTakeoutSessionId\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"MemberPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"Mode\",\"IsPack\",\"PersonCount\",\"NameUG\",\"NameZH\",\"NameEN\",\"Request\",\"Phone\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"SendAdminId\",\"SendTime\",\"Remark\")SELECT\"TakeoutId\",\"ServerTokenId\",\"ServerTakeoutId\",\"ServerTakeoutSessionId\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"MemberPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"Mode\",\"IsPack\",\"PersonCount\",\"NameUG\",\"NameZH\",\"NameEN\",\"Request\",\"Phone\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"SendAdminId\",\"SendTime\",\"Remark\"FROM\"_tb_takeout_old_20200206\";CREATE INDEX\"main\".\"tb_takeout_addTime\"ON\"tb_takeout\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_adminId\"ON\"tb_takeout\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_takeout_deviceId\"ON\"tb_takeout\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishAdminId\"ON\"tb_takeout\"(\"FinishAdminId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishDeviceId\"ON\"tb_takeout\"(\"FinishDeviceId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishTime\"ON\"tb_takeout\"(\"FinishTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_ispack\"ON\"tb_takeout\"(\"IsPack\"ASC);CREATE INDEX\"main\".\"tb_takeout_lang\"ON\"tb_takeout\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_takeout_memberId\"ON\"tb_takeout\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_takeout_mode\"ON\"tb_takeout\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_takeout_name\"ON\"tb_takeout\"(\"NameUG\"ASC,\"NameZH\"ASC,\"NameEN\"ASC);CREATE INDEX\"main\".\"tb_takeout_personCount\"ON\"tb_takeout\"(\"PersonCount\"ASC);CREATE INDEX\"main\".\"tb_takeout_phone\"ON\"tb_takeout\"(\"Phone\"ASC);CREATE INDEX\"main\".\"tb_takeout_recheckedcount\"ON\"tb_takeout\"(\"ReCheckedCount\"ASC);CREATE INDEX\"main\".\"tb_takeout_sendTime\"ON\"tb_takeout\"(\"SendTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_serverTakeoutSessionId\"ON\"tb_takeout\"(\"ServerTakeoutSessionId\"ASC);CREATE INDEX\"main\".\"tb_takeout_serverTokenId\"ON\"tb_takeout\"(\"ServerTokenId\"ASC);CREATE INDEX\"main\".\"tb_takeout_state\"ON\"tb_takeout\"(\"State\"ASC);CREATE INDEX\"main\".\"tb_takeout_updateTime\"ON\"tb_takeout\"(\"UpdateTime\"ASC);ALTER TABLE\"main\".\"tb_Ppr\"RENAME TO\"_tb_Ppr_old_20200206\";DROP INDEX\"main\".\"tb_ppr_printerId\";DROP INDEX\"main\".\"tb_ppr_productId\";CREATE TABLE\"main\".\"tb_Ppr\"(\"PprId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ProductId\"INTEGER NOT NULL,\"PrinterId\"INTEGER NOT NULL,CONSTRAINT\"fk_ppr_PrinterId\"FOREIGN KEY(\"PrinterId\")REFERENCES\"tb_printer\"(\"PrinterId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_ppr_ProductId\"FOREIGN KEY(\"ProductId\")REFERENCES\"tb_product\"(\"ProductId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_Ppr\"(\"PprId\",\"ProductId\",\"PrinterId\")SELECT\"PprId\",\"ProductId\",\"PrinterId\"FROM\"_tb_Ppr_old_20200206\";CREATE INDEX\"main\".\"tb_ppr_printerId\"ON\"tb_Ppr\"(\"PrinterId\"ASC);CREATE INDEX\"main\".\"tb_ppr_productId\"ON\"tb_Ppr\"(\"ProductId\"ASC);ALTER TABLE\"main\".\"tb_product\"RENAME TO\"_tb_product_old_20200206\";DROP INDEX\"main\".\"tb_product_productParent\";DROP INDEX\"main\".\"tb_product_productType\";CREATE TABLE\"main\".\"tb_product\"(\"ProductId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ProductTypeId\"INTEGER NOT NULL,\"ProductNameZH\"TEXT(100)NOT NULL,\"ProductNameUG\"TEXT(100)NOT NULL,\"ProductNameEN\"TEXT(100)NOT NULL,\"SpecificationZH\"TEXT(50),\"SpecificationUG\"TEXT(50),\"SpecificationEN\"TEXT(50),\"SourceZH\"TEXT(50),\"SourceUG\"TEXT(50),\"SourceEN\"TEXT(50),\"InfoZH\"TEXT(50),\"InfoUG\"TEXT(50),\"InfoEN\"TEXT(50),\"ProductServerType\"INTEGER NOT NULL,\"ProductLocalType\"INTEGER NOT NULL,\"ProductLocalHash\"TEXT(50),\"ProductServerHash\"TEXT(50),\"Barcode\"TEXT(32),\"IsScales\"INTEGER NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"PriceChangeMode\"INTEGER NOT NULL,\"PriceUpLimit\"REAL NOT NULL,\"PriceDownLimit\"REAL NOT NULL,\"CostPrice\"REAL NOT NULL,\"CostPriceChangeMode\"INTEGER NOT NULL,\"CostPriceUpLimit\"REAL NOT NULL,\"CostPriceDownLimit\"REAL NOT NULL,\"BalanceCount\"REAL NOT NULL,\"WarningCount\"REAL NOT NULL,\"IsBindCount\"INTEGER NOT NULL,\"ExpiredTime\"INTEGER NOT NULL DEFAULT 0,\"ExpiredTimeCount\"INTEGER NOT NULL DEFAULT 0,\"ProductParentId\"INTEGER,\"ProductParentCount\"REAL NOT NULL DEFAULT 1,\"ImageName\"TEXT(50),\"Order\"INTEGER NOT NULL,\"HideType\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"Description\"TEXT(300),\"Remark\"TEXT,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_product_productType\"FOREIGN KEY(\"ProductTypeId\")REFERENCES\"tb_producttype\"(\"ProductTypeId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_product_productParent\"FOREIGN KEY(\"ProductParentId\")REFERENCES\"tb_product\"(\"ProductId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_product\"(\"ProductId\",\"ProductTypeId\",\"ProductNameZH\",\"ProductNameUG\",\"ProductNameEN\",\"SpecificationZH\",\"SpecificationUG\",\"SpecificationEN\",\"SourceZH\",\"SourceUG\",\"SourceEN\",\"InfoZH\",\"InfoUG\",\"InfoEN\",\"ProductServerType\",\"ProductLocalType\",\"ProductLocalHash\",\"ProductServerHash\",\"Barcode\",\"IsScales\",\"Price\",\"PriceChangeMode\",\"PriceUpLimit\",\"PriceDownLimit\",\"CostPrice\",\"CostPriceChangeMode\",\"CostPriceUpLimit\",\"CostPriceDownLimit\",\"BalanceCount\",\"WarningCount\",\"IsBindCount\",\"ExpiredTime\",\"ExpiredTimeCount\",\"ProductParentId\",\"ProductParentCount\",\"ImageName\",\"Order\",\"HideType\",\"AddTime\",\"Description\",\"Remark\",\"UpdateTime\")SELECT\"ProductId\",\"ProductTypeId\",\"ProductNameZH\",\"ProductNameUG\",\"ProductNameEN\",\"SpecificationZH\",\"SpecificationUG\",\"SpecificationEN\",\"SourceZH\",\"SourceUG\",\"SourceEN\",\"InfoZH\",\"InfoUG\",\"InfoEN\",\"ProductServerType\",\"ProductLocalType\",\"ProductLocalHash\",\"ProductServerHash\",\"Barcode\",\"IsScales\",\"Price\",\"PriceChangeMode\",\"PriceUpLimit\",\"PriceDownLimit\",\"CostPrice\",\"CostPriceChangeMode\",\"CostPriceUpLimit\",\"CostPriceDownLimit\",\"BalanceCount\",\"WarningCount\",\"IsBindCount\",\"ExpiredTime\",\"ExpiredTimeCount\",\"ProductParentId\",\"ProductParentCount\",\"ImageName\",\"Order\",\"HideType\",\"AddTime\",\"Description\",\"Remark\",\"UpdateTime\"FROM\"_tb_product_old_20200206\";CREATE INDEX\"main\".\"tb_product_productParent\"ON\"tb_product\"(\"ProductParentId\"ASC);CREATE INDEX\"main\".\"tb_product_productType\"ON\"tb_product\"(\"ProductTypeId\"ASC);ALTER TABLE\"main\".\"tb_producttype\"RENAME TO\"_tb_producttype_old_20200206\";CREATE TABLE\"main\".\"tb_producttype\"(\"ProductTypeId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ParentId\"INTEGER,\"ProductTypeNameZH\"TEXT(50)NOT NULL,\"ProductTypeNameUG\"TEXT(50)NOT NULL,\"ProductTypeNameEN\"TEXT(50)NOT NULL,\"ImageName\"TEXT(50),\"Order\"INTEGER NOT NULL,\"HideType\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"Description\"TEXT(300),\"Remark\"TEXT,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_producttype_parent\"FOREIGN KEY(\"ParentId\")REFERENCES\"tb_producttype\"(\"ProductTypeId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_producttype\"(\"ProductTypeId\",\"ParentId\",\"ProductTypeNameZH\",\"ProductTypeNameUG\",\"ProductTypeNameEN\",\"ImageName\",\"Order\",\"HideType\",\"AddTime\",\"Description\",\"Remark\",\"UpdateTime\")SELECT\"ProductTypeId\",\"ParentId\",\"ProductTypeNameZH\",\"ProductTypeNameUG\",\"ProductTypeNameEN\",\"ImageName\",\"Order\",\"HideType\",\"AddTime\",\"Description\",\"Remark\",\"UpdateTime\"FROM\"_tb_producttype_old_20200206\";drop table\"_tb_adminpay_old_20200206\";drop table\"_tb_device_old_20200206\";drop table\"_tb_import_old_20200206\";drop table\"_tb_importdetail_old_20200206\";drop table\"_tb_importpay_old_20200206\";drop table\"_tb_log_old_20200206\";drop table\"_tb_member_old_20200206\";drop table\"_tb_memberpay_old_20200206\";drop table\"_tb_order_old_20200206\";drop table\"_tb_orderdetail_old_20200206\";drop table\"_tb_orderpay_old_20200206\";drop table\"_tb_returnpay_old_20200206\";drop table\"_tb_return_old_20200206\";drop table\"_tb_supplierpay_old_20200206\";drop table\"_tb_supplier_old_20200206\";drop table\"_tb_takeoutpay_old_20200206\";drop table\"_tb_takeoutdetail_old_20200206\";drop table\"_tb_takeout_old_20200206\";drop table\"_tb_Ppr_old_20200206\";drop table\"_tb_product_old_20200206\";drop table\"_tb_producttype_old_20200206\";";


        // admin pay, member pay, supplier pay add ParentBalance,  admin pay add BalancePrice. rate. extend menu size to 300. add Salt(for Password), remove tb_return. fix tb_takeout sendadminId ref
        private string SqlUpdateStatementVersion13 = "drop table \"tb_returnpay\";drop table \"tb_returndetail\";drop table \"tb_return\";" +
             "ALTER TABLE\"main\".\"tb_admin\"RENAME TO\"_tb_admin_old_20200216\";DROP INDEX\"main\".\"tb_admin_adminName\";DROP INDEX\"main\".\"tb_admin_adminNo\";DROP INDEX\"main\".\"tb_admin_idnumber\";DROP INDEX\"main\".\"tb_admin_lang\";DROP INDEX\"main\".\"tb_admin_mobile\";CREATE TABLE\"main\".\"tb_admin\"(\"AdminId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"AdminNo\"TEXT(20)NOT NULL,\"Password\"TEXT(32)NOT NULL,\"Salt\"TEXT(32),\"AdminNameUG\"TEXT(50)NOT NULL,\"AdminNameZH\"TEXT(50)NOT NULL,\"AdminNameEN\"TEXT(50)NOT NULL,\"Lang\"INTEGER NOT NULL,\"Sex\"INTEGER NOT NULL,\"Occupation\"TEXT(50),\"Mobile\"TEXT(30),\"ImageName\"TEXT(30),\"IDNumber\"TEXT(30),\"AddressUG\"TEXT(300),\"AddressZH\"TEXT(300),\"AddressEN\"TEXT(300),\"OfferRate\"REAL NOT NULL DEFAULT 0,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"SpendPrice\"REAL NOT NULL DEFAULT 0,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Mode\"INTEGER NOT NULL,\"Menu\"TEXT(500),\"IsOnlyOwn\"INTEGER NOT NULL,\"Order\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT);INSERT INTO\"main\".\"tb_admin\"(\"AdminId\",\"AdminNo\",\"Password\",\"AdminNameUG\",\"AdminNameZH\",\"AdminNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"Mode\",\"Menu\",\"IsOnlyOwn\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"AdminId\",\"AdminNo\",\"Password\",\"AdminNameUG\",\"AdminNameZH\",\"AdminNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"Mode\",\"Menu\",\"IsOnlyOwn\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_admin_old_20200216\";CREATE INDEX\"main\".\"tb_admin_adminName\"ON\"tb_admin\"(\"AdminNameUG\"ASC,\"AdminNameZH\"ASC,\"AdminNameEN\"ASC);CREATE INDEX\"main\".\"tb_admin_adminNo\"ON\"tb_admin\"(\"AdminNo\"ASC);CREATE INDEX\"main\".\"tb_admin_idnumber\"ON\"tb_admin\"(\"IDNumber\"ASC);CREATE INDEX\"main\".\"tb_admin_lang\"ON\"tb_admin\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_admin_mobile\"ON\"tb_admin\"(\"Mobile\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=1 WHERE name='tb_admin';ALTER TABLE\"main\".\"tb_adminpay\"RENAME TO\"_tb_adminpay_old_20200216\";DROP INDEX\"main\".\"tb_adminPay_addAdminId\";DROP INDEX\"main\".\"tb_adminPay_addTime\";DROP INDEX\"main\".\"tb_adminPay_adminId\";DROP INDEX\"main\".\"tb_adminPay_balanceId\";DROP INDEX\"main\".\"tb_adminPay_deviceId\";DROP INDEX\"main\".\"tb_adminPay_mode\";CREATE TABLE\"main\".\"tb_adminpay\"(\"AdminPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"AdminId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 0,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"ParentBalancePrice\"REAL,\"AddAdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_adminpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_addAdminId\"FOREIGN KEY(\"AddAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_adminpay\"(\"AdminPayId\",\"AdminId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"Price\",\"BalancePrice\",\"AddAdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"AdminPayId\",\"AdminId\",\"BalanceId\",\"OriginalPrice\",\"RemoveRate\",\"Price\",\"BalancePrice\",\"AddAdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_adminpay_old_20200216\";CREATE INDEX\"main\".\"tb_adminPay_addAdminId\"ON\"tb_adminpay\"(\"AddAdminId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_addTime\"ON\"tb_adminpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_adminPay_adminId\"ON\"tb_adminpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_balanceId\"ON\"tb_adminpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_deviceId\"ON\"tb_adminpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_mode\"ON\"tb_adminpay\"(\"Mode\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_adminpay';ALTER TABLE\"main\".\"tb_memberpay\"RENAME TO\"_tb_memberpay_old_20200216\";DROP INDEX\"main\".\"tb_memberpay_addTime\";DROP INDEX\"main\".\"tb_memberpay_adminId\";DROP INDEX\"main\".\"tb_memberpay_balanceId\";DROP INDEX\"main\".\"tb_memberpay_deviceId\";DROP INDEX\"main\".\"tb_memberpay_memberId\";DROP INDEX\"main\".\"tb_memberpay_mode\";CREATE TABLE\"main\".\"tb_memberpay\"(\"MemberPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"MemberId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 100,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"ParentBalancePrice\"REAL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_memberpay_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_memberpay\"(\"MemberPayId\",\"MemberId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"MemberPayId\",\"MemberId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_memberpay_old_20200216\";CREATE INDEX\"main\".\"tb_memberpay_addTime\"ON\"tb_memberpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_memberpay_adminId\"ON\"tb_memberpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_balanceId\"ON\"tb_memberpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_deviceId\"ON\"tb_memberpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_memberId\"ON\"tb_memberpay\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_mode\"ON\"tb_memberpay\"(\"Mode\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_memberpay';ALTER TABLE\"main\".\"tb_supplierpay\"RENAME TO\"_tb_supplierpay_old_20200216\";DROP INDEX\"main\".\"tb_supplierpay_addTime\";DROP INDEX\"main\".\"tb_supplierpay_adminId\";DROP INDEX\"main\".\"tb_supplierpay_balanceId\";DROP INDEX\"main\".\"tb_supplierpay_deviceId\";DROP INDEX\"main\".\"tb_supplierpay_mode\";DROP INDEX\"main\".\"tb_supplierpay_supplierId\";CREATE TABLE\"main\".\"tb_supplierpay\"(\"SupplierPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"SupplierId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 100,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"ParentBalancePrice\"REAL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"IsAuto\"INTEGER NOT NULL DEFAULT 0,\"AutoOperateName\"TEXT(30),\"AutoOperateId\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_supplierpay_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_supplierpay\"(\"SupplierPayId\",\"SupplierId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\")SELECT\"SupplierPayId\",\"SupplierId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"IsAuto\",\"AutoOperateName\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_supplierpay_old_20200216\";CREATE INDEX\"main\".\"tb_supplierpay_addTime\"ON\"tb_supplierpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_adminId\"ON\"tb_supplierpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_balanceId\"ON\"tb_supplierpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_deviceId\"ON\"tb_supplierpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_mode\"ON\"tb_supplierpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_supplierId\"ON\"tb_supplierpay\"(\"SupplierId\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_supplierpay';ALTER TABLE\"main\".\"tb_takeout\"RENAME TO\"_tb_takeout_old_20200216\";DROP INDEX\"main\".\"tb_takeout_addTime\";DROP INDEX\"main\".\"tb_takeout_adminId\";DROP INDEX\"main\".\"tb_takeout_deviceId\";DROP INDEX\"main\".\"tb_takeout_finishAdminId\";DROP INDEX\"main\".\"tb_takeout_finishDeviceId\";DROP INDEX\"main\".\"tb_takeout_finishTime\";DROP INDEX\"main\".\"tb_takeout_ispack\";DROP INDEX\"main\".\"tb_takeout_lang\";DROP INDEX\"main\".\"tb_takeout_memberId\";DROP INDEX\"main\".\"tb_takeout_mode\";DROP INDEX\"main\".\"tb_takeout_name\";DROP INDEX\"main\".\"tb_takeout_personCount\";DROP INDEX\"main\".\"tb_takeout_phone\";DROP INDEX\"main\".\"tb_takeout_recheckedcount\";DROP INDEX\"main\".\"tb_takeout_sendTime\";DROP INDEX\"main\".\"tb_takeout_serverTakeoutSessionId\";DROP INDEX\"main\".\"tb_takeout_serverTokenId\";DROP INDEX\"main\".\"tb_takeout_state\";DROP INDEX\"main\".\"tb_takeout_updateTime\";CREATE TABLE\"main\".\"tb_takeout\"(\"TakeoutId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ServerTokenId\"TEXT(50),\"ServerTakeoutId\"TEXT(50),\"ServerTakeoutSessionId\"TEXT(50),\"State\"INTEGER NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"MemberPaidPrice\"REAL NOT NULL,\"PaidPrice\"REAL NOT NULL,\"TotalPaidPrice\"REAL NOT NULL,\"BorrowPrice\"REAL NOT NULL,\"KeepPrice\"REAL NOT NULL,\"Lang\"INTEGER NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"MemberId\"INTEGER,\"Mode\"INTEGER NOT NULL,\"IsPack\"INTEGER NOT NULL,\"PersonCount\"INTEGER NOT NULL,\"NameUG\"TEXT(50),\"NameZH\"TEXT(50),\"NameEN\"TEXT(50),\"Request\"TEXT(100),\"Phone\"TEXT(50),\"AddressUG\"TEXT(100),\"AddressZH\"TEXT(100),\"AddressEN\"TEXT(100),\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"ReCheckedCount\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"FinishAdminId\"INTEGER NOT NULL,\"FinishDeviceId\"INTEGER NOT NULL,\"FinishTime\"INTEGER,\"SendAdminId\"INTEGER,\"SendTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_takeout_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_sendadminId\"FOREIGN KEY(\"SendAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_finishAdminId\"FOREIGN KEY(\"FinishAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_finishDeviceId\"FOREIGN KEY(\"FinishDeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_takeout\"(\"TakeoutId\",\"ServerTokenId\",\"ServerTakeoutId\",\"ServerTakeoutSessionId\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"MemberPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"Mode\",\"IsPack\",\"PersonCount\",\"NameUG\",\"NameZH\",\"NameEN\",\"Request\",\"Phone\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"SendAdminId\",\"SendTime\",\"Remark\")SELECT\"TakeoutId\",\"ServerTokenId\",\"ServerTakeoutId\",\"ServerTakeoutSessionId\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"MemberPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"Mode\",\"IsPack\",\"PersonCount\",\"NameUG\",\"NameZH\",\"NameEN\",\"Request\",\"Phone\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"SendAdminId\",\"SendTime\",\"Remark\"FROM\"_tb_takeout_old_20200216\";CREATE INDEX\"main\".\"tb_takeout_addTime\"ON\"tb_takeout\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_adminId\"ON\"tb_takeout\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_takeout_deviceId\"ON\"tb_takeout\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishAdminId\"ON\"tb_takeout\"(\"FinishAdminId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishDeviceId\"ON\"tb_takeout\"(\"FinishDeviceId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishTime\"ON\"tb_takeout\"(\"FinishTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_ispack\"ON\"tb_takeout\"(\"IsPack\"ASC);CREATE INDEX\"main\".\"tb_takeout_lang\"ON\"tb_takeout\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_takeout_memberId\"ON\"tb_takeout\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_takeout_mode\"ON\"tb_takeout\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_takeout_name\"ON\"tb_takeout\"(\"NameUG\"ASC,\"NameZH\"ASC,\"NameEN\"ASC);CREATE INDEX\"main\".\"tb_takeout_personCount\"ON\"tb_takeout\"(\"PersonCount\"ASC);CREATE INDEX\"main\".\"tb_takeout_phone\"ON\"tb_takeout\"(\"Phone\"ASC);CREATE INDEX\"main\".\"tb_takeout_recheckedcount\"ON\"tb_takeout\"(\"ReCheckedCount\"ASC);CREATE INDEX\"main\".\"tb_takeout_sendTime\"ON\"tb_takeout\"(\"SendTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_serverTakeoutSessionId\"ON\"tb_takeout\"(\"ServerTakeoutSessionId\"ASC);CREATE INDEX\"main\".\"tb_takeout_serverTokenId\"ON\"tb_takeout\"(\"ServerTokenId\"ASC);CREATE INDEX\"main\".\"tb_takeout_state\"ON\"tb_takeout\"(\"State\"ASC);CREATE INDEX\"main\".\"tb_takeout_updateTime\"ON\"tb_takeout\"(\"UpdateTime\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_takeout';";

        // change all language to index mode language like: lang0, lang1, lang2.   remove IsAuto, AutoOperateId, AutoOperateName from tb_balancepay, tb_memberpay, tb_supplierpay
        private string SqlUpdateStatementVersion14 = "ALTER TABLE\"main\".\"tb_admin\"RENAME TO\"_tb_admin_old_20200217\";DROP INDEX\"main\".\"tb_admin_adminName\";DROP INDEX\"main\".\"tb_admin_adminNo\";DROP INDEX\"main\".\"tb_admin_idnumber\";DROP INDEX\"main\".\"tb_admin_lang\";DROP INDEX\"main\".\"tb_admin_mobile\";CREATE TABLE\"main\".\"tb_admin\"(\"AdminId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"AdminNo\"TEXT(20)NOT NULL,\"Password\"TEXT(32)NOT NULL,\"Salt\"TEXT(32),\"AdminName0\"TEXT(50)NOT NULL,\"AdminName1\"TEXT(50)NOT NULL,\"AdminName2\"TEXT(50)NOT NULL,\"Lang\"INTEGER NOT NULL,\"Sex\"INTEGER NOT NULL,\"Occupation\"TEXT(50),\"Mobile\"TEXT(50),\"ImageName\"TEXT(30),\"IDNumber\"TEXT(30),\"Address0\"TEXT(300),\"Address1\"TEXT(300),\"Address2\"TEXT(300),\"OfferRate\"REAL NOT NULL DEFAULT 0,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"SpendPrice\"REAL NOT NULL DEFAULT 0,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Mode\"INTEGER NOT NULL,\"Menu\"TEXT(500),\"IsOnlyOwn\"INTEGER NOT NULL,\"Order\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT);INSERT INTO\"main\".\"tb_admin\"(\"AdminId\",\"AdminNo\",\"Password\",\"Salt\",\"AdminName1\",\"AdminName0\",\"AdminName2\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"ImageName\",\"IDNumber\",\"Address1\",\"Address0\",\"Address2\",\"OfferRate\",\"BalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"Mode\",\"Menu\",\"IsOnlyOwn\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"AdminId\",\"AdminNo\",\"Password\",\"Salt\",\"AdminNameUG\",\"AdminNameZH\",\"AdminNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"OfferRate\",\"BalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"Mode\",\"Menu\",\"IsOnlyOwn\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_admin_old_20200217\";CREATE INDEX\"main\".\"tb_admin_adminName\"ON\"tb_admin\"(\"AdminName0\"ASC,\"AdminName1\"ASC,\"AdminName2\"ASC);CREATE INDEX\"main\".\"tb_admin_adminNo\"ON\"tb_admin\"(\"AdminNo\"ASC);CREATE INDEX\"main\".\"tb_admin_idnumber\"ON\"tb_admin\"(\"IDNumber\"ASC);CREATE INDEX\"main\".\"tb_admin_lang\"ON\"tb_admin\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_admin_mobile\"ON\"tb_admin\"(\"Mobile\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=1 WHERE name='tb_admin';ALTER TABLE\"main\".\"tb_adminpay\"RENAME TO\"_tb_adminpay_old_20200217\";DROP INDEX\"main\".\"tb_adminPay_addAdminId\";DROP INDEX\"main\".\"tb_adminPay_addTime\";DROP INDEX\"main\".\"tb_adminPay_adminId\";DROP INDEX\"main\".\"tb_adminPay_balanceId\";DROP INDEX\"main\".\"tb_adminPay_deviceId\";DROP INDEX\"main\".\"tb_adminPay_mode\";CREATE TABLE\"main\".\"tb_adminpay\"(\"AdminPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"AdminId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 0,\"FavorablePrice\"REAL NOT NULL,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"ParentBalancePrice\"REAL,\"AddAdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_adminpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_addAdminId\"FOREIGN KEY(\"AddAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_adminpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_adminpay\"(\"AdminPayId\",\"AdminId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"ParentBalancePrice\",\"AddAdminId\",\"DeviceId\",\"Mode\",\"Remark\",\"AddTime\")SELECT\"AdminPayId\",\"AdminId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"ParentBalancePrice\",\"AddAdminId\",\"DeviceId\",\"Mode\",\"Remark\",\"AddTime\"FROM\"_tb_adminpay_old_20200217\";CREATE INDEX\"main\".\"tb_adminPay_addAdminId\"ON\"tb_adminpay\"(\"AddAdminId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_addTime\"ON\"tb_adminpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_adminPay_adminId\"ON\"tb_adminpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_balanceId\"ON\"tb_adminpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_deviceId\"ON\"tb_adminpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_adminPay_mode\"ON\"tb_adminpay\"(\"Mode\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_adminpay';ALTER TABLE\"main\".\"tb_balance\"RENAME TO\"_tb_balance_old_20200217\";CREATE TABLE\"main\".\"tb_balance\"(\"BalanceId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"BalanceName0\"TEXT(50)NOT NULL,\"BalanceName1\"TEXT(50)NOT NULL,\"BalanceName2\"TEXT(50)NOT NULL,\"AccountNo\"TEXT(50),\"AccountName\"TEXT(50),\"AccountBank\"TEXT(50),\"BalancePrice\"REAL NOT NULL,\"BalanceType\"INTEGER NOT NULL,\"RemoveRate\"REAL NOT NULL DEFAULT 0,\"IsBind\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"HideType\"INTEGER NOT NULL DEFAULT 0,\"Order\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT);INSERT INTO\"main\".\"tb_balance\"(\"BalanceId\",\"BalanceName1\",\"BalanceName0\",\"BalanceName2\",\"AccountNo\",\"AccountName\",\"AccountBank\",\"BalancePrice\",\"BalanceType\",\"RemoveRate\",\"IsBind\",\"AddTime\",\"UpdateTime\",\"HideType\",\"Order\",\"Remark\")SELECT\"BalanceId\",\"BalanceNameUG\",\"BalanceNameZH\",\"BalanceNameEN\",\"AccountNo\",\"AccountName\",\"AccountBank\",\"BalancePrice\",\"BalanceType\",\"RemoveRate\",\"IsBind\",\"AddTime\",\"UpdateTime\",\"HideType\",\"Order\",\"Remark\"FROM\"_tb_balance_old_20200217\";UPDATE\"main\".\"sqlite_sequence\"SET seq=1 WHERE name='tb_balance';ALTER TABLE\"main\".\"tb_balancepay\"RENAME TO\"_tb_balancepay_old_20200217\";DROP INDEX\"main\".\"tb_balancePay_addTime\";DROP INDEX\"main\".\"tb_balancePay_adminId\";DROP INDEX\"main\".\"tb_balancePay_balanceId\";DROP INDEX\"main\".\"tb_balancePay_deviceId\";DROP INDEX\"main\".\"tb_balancePay_mode\";CREATE TABLE\"main\".\"tb_balancepay\"(\"BalancePayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"RemoveRate\"REAL NOT NULL DEFAULT 0,\"RemovePrice\"REAL NOT NULL,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"TransferId\"INTEGER NOT NULL DEFAULT 0,\"TransferMode\"INTEGER NOT NULL DEFAULT 0,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_balancepay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_balancepay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_balancepay_blanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_balancepay\"(\"BalancePayId\",\"BalanceId\",\"OriginalPrice\",\"RemoveRate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"TransferId\",\"Remark\",\"AddTime\")SELECT\"BalancePayId\",\"BalanceId\",\"OriginalPrice\",\"RemoveRate\",\"RemovePrice\",\"Price\",\"BalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"AutoOperateId\",\"Remark\",\"AddTime\"FROM\"_tb_balancepay_old_20200217\";CREATE INDEX\"main\".\"tb_balancePay_addTime\"ON\"tb_balancepay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_balancePay_adminId\"ON\"tb_balancepay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_balancePay_balanceId\"ON\"tb_balancepay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_balancePay_deviceId\"ON\"tb_balancepay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_balancePay_mode\"ON\"tb_balancepay\"(\"Mode\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_balancepay';ALTER TABLE\"main\".\"tb_member\"RENAME TO\"_tb_member_old_20200217\";DROP INDEX\"main\".\"tb_member_addTime\";DROP INDEX\"main\".\"tb_member_adminID\";DROP INDEX\"main\".\"tb_member_CardNo\";DROP INDEX\"main\".\"tb_member_expiredTime\";DROP INDEX\"main\".\"tb_member_lang\";DROP INDEX\"main\".\"tb_member_memberName\";DROP INDEX\"main\".\"tb_member_memberNo\";DROP INDEX\"main\".\"tb_member_mobile\";DROP INDEX\"main\".\"tb_member_password\";DROP INDEX\"main\".\"tb_member_phone\";DROP INDEX\"main\".\"tb_member_updateTime\";CREATE TABLE\"main\".\"tb_member\"(\"MemberId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"MemberNo\"TEXT(50)NOT NULL,\"CardNo\"TEXT(50)DEFAULT NULL,\"Password\"TEXT(32),\"MemberName0\"TEXT(50)NOT NULL,\"MemberName1\"TEXT(50)NOT NULL,\"MemberName2\"TEXT(50)NOT NULL,\"Lang\"INTEGER NOT NULL,\"Sex\"INTEGER NOT NULL,\"Occupation\"INTEGER NOT NULL,\"Mobile\"TEXT(50),\"Phone\"TEXT(50),\"ImageName\"TEXT(30),\"IDNumber\"TEXT(30),\"Address0\"TEXT(300),\"Address1\"TEXT(300),\"Address2\"TEXT(300),\"AddressLocation\"TEXT(50),\"AdminId\"INTEGER,\"OfferRate\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"MinBalancePrice\"REAL NOT NULL,\"MaxBalancePrice\"REAL NOT NULL,\"SpendPrice\"REAL NOT NULL,\"FavorablePrice\"REAL NOT NULL,\"ExpiredTime\"INTEGER NOT NULL,\"IsAllowBorrow\"INTEGER NOT NULL DEFAULT 0,\"Order\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT,CONSTRAINT\"fk_member_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_member\"(\"MemberId\",\"MemberNo\",\"CardNo\",\"Password\",\"MemberName1\",\"MemberName0\",\"MemberName2\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"Phone\",\"ImageName\",\"IDNumber\",\"Address1\",\"Address0\",\"Address2\",\"AddressLocation\",\"AdminId\",\"OfferRate\",\"BalancePrice\",\"MinBalancePrice\",\"MaxBalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"ExpiredTime\",\"IsAllowBorrow\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"MemberId\",\"MemberNo\",\"CardNo\",\"Password\",\"MemberNameUG\",\"MemberNameZH\",\"MemberNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"Phone\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"AddressLocation\",\"AdminId\",\"OfferRate\",\"BalancePrice\",\"MinBalancePrice\",\"MaxBalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"ExpiredTime\",\"IsAllowBorrow\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_member_old_20200217\";CREATE INDEX\"main\".\"tb_member_CardNo\"ON\"tb_member\"(\"CardNo\"ASC);CREATE INDEX\"main\".\"tb_member_addTime\"ON\"tb_member\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_member_adminID\"ON\"tb_member\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_member_expiredTime\"ON\"tb_member\"(\"ExpiredTime\"ASC);CREATE INDEX\"main\".\"tb_member_lang\"ON\"tb_member\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_member_memberName\"ON\"tb_member\"(\"MemberName0\"ASC,\"MemberName1\"ASC,\"MemberName2\"ASC);CREATE UNIQUE INDEX\"main\".\"tb_member_memberNo\"ON\"tb_member\"(\"MemberNo\"ASC);CREATE INDEX\"main\".\"tb_member_mobile\"ON\"tb_member\"(\"Mobile\"ASC);CREATE INDEX\"main\".\"tb_member_password\"ON\"tb_member\"(\"Password\"ASC);CREATE INDEX\"main\".\"tb_member_phone\"ON\"tb_member\"(\"Phone\"ASC);CREATE INDEX\"main\".\"tb_member_updateTime\"ON\"tb_member\"(\"UpdateTime\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_member';ALTER TABLE\"main\".\"tb_memberpay\"RENAME TO\"_tb_memberpay_old_20200217\";DROP INDEX\"main\".\"tb_memberpay_addTime\";DROP INDEX\"main\".\"tb_memberpay_adminId\";DROP INDEX\"main\".\"tb_memberpay_balanceId\";DROP INDEX\"main\".\"tb_memberpay_deviceId\";DROP INDEX\"main\".\"tb_memberpay_memberId\";DROP INDEX\"main\".\"tb_memberpay_mode\";CREATE TABLE\"main\".\"tb_memberpay\"(\"MemberPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"MemberId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 100,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL DEFAULT 0,\"ParentBalancePrice\"REAL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_memberpay_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_memberpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_memberpay\"(\"MemberPayId\",\"MemberId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"ParentBalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"Remark\",\"AddTime\")SELECT\"MemberPayId\",\"MemberId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"ParentBalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"Remark\",\"AddTime\"FROM\"_tb_memberpay_old_20200217\";CREATE INDEX\"main\".\"tb_memberpay_addTime\"ON\"tb_memberpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_memberpay_adminId\"ON\"tb_memberpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_balanceId\"ON\"tb_memberpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_deviceId\"ON\"tb_memberpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_memberId\"ON\"tb_memberpay\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_memberpay_mode\"ON\"tb_memberpay\"(\"Mode\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_memberpay';ALTER TABLE\"main\".\"tb_printer\"RENAME TO\"_tb_printer_old_20200217\";CREATE TABLE\"main\".\"tb_printer\"(\"PrinterId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"PrinterName0\"TEXT(50)NOT NULL,\"PrinterName1\"TEXT(50)NOT NULL,\"PrinterName2\"TEXT(50)NOT NULL,\"PrinterDeviceName\"TEXT(100)NOT NULL,\"PrintType\"INTEGER NOT NULL,\"PrintSize\"INTEGER NOT NULL,\"Lang\"INTEGER NOT NULL,\"Order\"INTEGER NOT NULL,\"IsMain\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT);INSERT INTO\"main\".\"tb_printer\"(\"PrinterId\",\"PrinterName1\",\"PrinterName0\",\"PrinterName2\",\"PrinterDeviceName\",\"PrintType\",\"PrintSize\",\"Lang\",\"Order\",\"IsMain\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"PrinterId\",\"PrinterNameUG\",\"PrinterNameZH\",\"PrinterNameEN\",\"PrinterDeviceName\",\"PrintType\",\"PrintSize\",\"Lang\",\"Order\",\"IsMain\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_printer_old_20200217\";ALTER TABLE\"main\".\"tb_product\"RENAME TO\"_tb_product_old_20200217\";DROP INDEX\"main\".\"tb_product_productParent\";DROP INDEX\"main\".\"tb_product_productType\";CREATE TABLE\"main\".\"tb_product\"(\"ProductId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ProductTypeId\"INTEGER NOT NULL,\"ProductName0\"TEXT(100)NOT NULL,\"ProductName1\"TEXT(100)NOT NULL,\"ProductName2\"TEXT(100)NOT NULL,\"Specification0\"TEXT(50),\"Specification1\"TEXT(50),\"Specification2\"TEXT(50),\"Source0\"TEXT(50),\"Source1\"TEXT(50),\"Source2\"TEXT(50),\"Info0\"TEXT(50),\"Info1\"TEXT(50),\"Info2\"TEXT(50),\"ProductServerType\"INTEGER NOT NULL,\"ProductLocalType\"INTEGER NOT NULL,\"ProductLocalHash\"TEXT(50),\"ProductServerHash\"TEXT(50),\"Barcode\"TEXT(32),\"IsScales\"INTEGER NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"PriceChangeMode\"INTEGER NOT NULL,\"PriceUpLimit\"REAL NOT NULL,\"PriceDownLimit\"REAL NOT NULL,\"CostPrice\"REAL NOT NULL,\"CostPriceChangeMode\"INTEGER NOT NULL,\"CostPriceUpLimit\"REAL NOT NULL,\"CostPriceDownLimit\"REAL NOT NULL,\"BalanceCount\"REAL NOT NULL,\"WarningCount\"REAL NOT NULL,\"IsBindCount\"INTEGER NOT NULL,\"ExpiredTime\"INTEGER NOT NULL DEFAULT 0,\"ExpiredTimeCount\"INTEGER NOT NULL DEFAULT 0,\"ProductParentId\"INTEGER,\"ProductParentCount\"REAL NOT NULL DEFAULT 1,\"ImageName\"TEXT(50),\"Order\"INTEGER NOT NULL,\"HideType\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"Description\"TEXT(300),\"Remark\"TEXT,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_product_productType\"FOREIGN KEY(\"ProductTypeId\")REFERENCES\"tb_producttype\"(\"ProductTypeId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_product_productParent\"FOREIGN KEY(\"ProductParentId\")REFERENCES\"tb_product\"(\"ProductId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_product\"(\"ProductId\",\"ProductTypeId\",\"ProductName0\",\"ProductName1\",\"ProductName2\",\"Specification0\",\"Specification1\",\"Specification2\",\"Source0\",\"Source1\",\"Source2\",\"Info0\",\"Info1\",\"Info2\",\"ProductServerType\",\"ProductLocalType\",\"ProductLocalHash\",\"ProductServerHash\",\"Barcode\",\"IsScales\",\"Price\",\"PriceChangeMode\",\"PriceUpLimit\",\"PriceDownLimit\",\"CostPrice\",\"CostPriceChangeMode\",\"CostPriceUpLimit\",\"CostPriceDownLimit\",\"BalanceCount\",\"WarningCount\",\"IsBindCount\",\"ExpiredTime\",\"ExpiredTimeCount\",\"ProductParentId\",\"ProductParentCount\",\"ImageName\",\"Order\",\"HideType\",\"AddTime\",\"Description\",\"Remark\",\"UpdateTime\")SELECT\"ProductId\",\"ProductTypeId\",\"ProductNameZH\",\"ProductNameUG\",\"ProductNameEN\",\"SpecificationZH\",\"SpecificationUG\",\"SpecificationEN\",\"SourceZH\",\"SourceUG\",\"SourceEN\",\"InfoZH\",\"InfoUG\",\"InfoEN\",\"ProductServerType\",\"ProductLocalType\",\"ProductLocalHash\",\"ProductServerHash\",\"Barcode\",\"IsScales\",\"Price\",\"PriceChangeMode\",\"PriceUpLimit\",\"PriceDownLimit\",\"CostPrice\",\"CostPriceChangeMode\",\"CostPriceUpLimit\",\"CostPriceDownLimit\",\"BalanceCount\",\"WarningCount\",\"IsBindCount\",\"ExpiredTime\",\"ExpiredTimeCount\",\"ProductParentId\",\"ProductParentCount\",\"ImageName\",\"Order\",\"HideType\",\"AddTime\",\"Description\",\"Remark\",\"UpdateTime\"FROM\"_tb_product_old_20200217\";CREATE INDEX\"main\".\"tb_product_productParent\"ON\"tb_product\"(\"ProductParentId\"ASC);CREATE INDEX\"main\".\"tb_product_productType\"ON\"tb_product\"(\"ProductTypeId\"ASC);ALTER TABLE\"main\".\"tb_producttype\"RENAME TO\"_tb_producttype_old_20200217\";CREATE TABLE\"main\".\"tb_producttype\"(\"ProductTypeId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ParentId\"INTEGER,\"ProductTypeName0\"TEXT(50)NOT NULL,\"ProductTypeName1\"TEXT(50)NOT NULL,\"ProductTypeName2\"TEXT(50)NOT NULL,\"ImageName\"TEXT(50),\"Order\"INTEGER NOT NULL,\"HideType\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"Description\"TEXT(300),\"Remark\"TEXT,\"UpdateTime\"INTEGER,CONSTRAINT\"fk_producttype_parent\"FOREIGN KEY(\"ParentId\")REFERENCES\"tb_producttype\"(\"ProductTypeId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_producttype\"(\"ProductTypeId\",\"ParentId\",\"ProductTypeName0\",\"ProductTypeName1\",\"ProductTypeName2\",\"ImageName\",\"Order\",\"HideType\",\"AddTime\",\"Description\",\"Remark\",\"UpdateTime\")SELECT\"ProductTypeId\",\"ParentId\",\"ProductTypeNameZH\",\"ProductTypeNameUG\",\"ProductTypeNameEN\",\"ImageName\",\"Order\",\"HideType\",\"AddTime\",\"Description\",\"Remark\",\"UpdateTime\"FROM\"_tb_producttype_old_20200217\";UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_producttype';ALTER TABLE\"main\".\"tb_request\"RENAME TO\"_tb_request_old_20200217\";CREATE TABLE\"main\".\"tb_request\"(\"RequestId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"RequestName0\"TEXT(50)NOT NULL,\"RequestName1\"TEXT(50)NOT NULL,\"RequestName2\"TEXT(50)NOT NULL,\"Order\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER NOT NULL,\"Remark\"TEXT);INSERT INTO\"main\".\"tb_request\"(\"RequestId\",\"RequestName1\",\"RequestName0\",\"RequestName2\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"RequestId\",\"RequestNameUG\",\"RequestNameZH\",\"RequestNameEN\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_request_old_20200217\";ALTER TABLE\"main\".\"tb_supplier\"RENAME TO\"_tb_supplier_old_20200217\";DROP INDEX\"main\".\"tb_supplier_addTime\";DROP INDEX\"main\".\"tb_supplier_adminID\";DROP INDEX\"main\".\"tb_supplier_CardNo\";DROP INDEX\"main\".\"tb_supplier_expiredTime\";DROP INDEX\"main\".\"tb_supplier_lang\";DROP INDEX\"main\".\"tb_supplier_memberName\";DROP INDEX\"main\".\"tb_supplier_memberNo\";DROP INDEX\"main\".\"tb_supplier_mobile\";DROP INDEX\"main\".\"tb_supplier_password\";DROP INDEX\"main\".\"tb_supplier_phone\";DROP INDEX\"main\".\"tb_supplier_updateTime\";CREATE TABLE\"main\".\"tb_supplier\"(\"SupplierId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"SupplierNo\"TEXT(50)NOT NULL,\"CardNo\"TEXT(50)DEFAULT NULL,\"Password\"TEXT(32),\"SupplierName0\"TEXT(50)NOT NULL,\"SupplierName1\"TEXT(50)NOT NULL,\"SupplierName2\"TEXT(50)NOT NULL,\"Lang\"INTEGER NOT NULL,\"Sex\"INTEGER NOT NULL,\"Occupation\"INTEGER NOT NULL,\"Mobile\"TEXT(30),\"Phone\"TEXT(30),\"ImageName\"TEXT(30),\"IDNumber\"TEXT(30),\"Address0\"TEXT(300),\"Address1\"TEXT(300),\"Address2\"TEXT(300),\"AddressLocation\"TEXT(50),\"AdminId\"INTEGER,\"OfferRate\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"MinBalancePrice\"REAL NOT NULL,\"MaxBalancePrice\"REAL NOT NULL,\"SpendPrice\"REAL NOT NULL,\"FavorablePrice\"REAL NOT NULL,\"ExpiredTime\"INTEGER NOT NULL,\"IsAllowBorrow\"INTEGER NOT NULL DEFAULT 0,\"Order\"INTEGER NOT NULL,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT,CONSTRAINT\"fk_supplier_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_supplier\"(\"SupplierId\",\"SupplierNo\",\"CardNo\",\"Password\",\"SupplierName1\",\"SupplierName0\",\"SupplierName2\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"Phone\",\"ImageName\",\"IDNumber\",\"Address1\",\"Address0\",\"Address2\",\"AddressLocation\",\"AdminId\",\"OfferRate\",\"BalancePrice\",\"MinBalancePrice\",\"MaxBalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"ExpiredTime\",\"IsAllowBorrow\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"SupplierId\",\"SupplierNo\",\"CardNo\",\"Password\",\"SupplierNameUG\",\"SupplierNameZH\",\"SupplierNameEN\",\"Lang\",\"Sex\",\"Occupation\",\"Mobile\",\"Phone\",\"ImageName\",\"IDNumber\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"AddressLocation\",\"AdminId\",\"OfferRate\",\"BalancePrice\",\"MinBalancePrice\",\"MaxBalancePrice\",\"SpendPrice\",\"FavorablePrice\",\"ExpiredTime\",\"IsAllowBorrow\",\"Order\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_supplier_old_20200217\";CREATE INDEX\"main\".\"tb_supplier_CardNo\"ON\"tb_supplier\"(\"CardNo\"ASC);CREATE INDEX\"main\".\"tb_supplier_addTime\"ON\"tb_supplier\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_supplier_adminID\"ON\"tb_supplier\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_supplier_expiredTime\"ON\"tb_supplier\"(\"ExpiredTime\"ASC);CREATE INDEX\"main\".\"tb_supplier_lang\"ON\"tb_supplier\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_supplier_memberName\"ON\"tb_supplier\"(\"SupplierName0\"ASC,\"SupplierName1\"ASC,\"SupplierName2\"ASC);CREATE UNIQUE INDEX\"main\".\"tb_supplier_memberNo\"ON\"tb_supplier\"(\"SupplierNo\"ASC);CREATE INDEX\"main\".\"tb_supplier_mobile\"ON\"tb_supplier\"(\"Mobile\"ASC);CREATE INDEX\"main\".\"tb_supplier_password\"ON\"tb_supplier\"(\"Password\"ASC);CREATE INDEX\"main\".\"tb_supplier_phone\"ON\"tb_supplier\"(\"Phone\"ASC);CREATE INDEX\"main\".\"tb_supplier_updateTime\"ON\"tb_supplier\"(\"UpdateTime\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_supplier';ALTER TABLE\"main\".\"tb_supplierpay\"RENAME TO\"_tb_supplierpay_old_20200217\";DROP INDEX\"main\".\"tb_supplierpay_addTime\";DROP INDEX\"main\".\"tb_supplierpay_adminId\";DROP INDEX\"main\".\"tb_supplierpay_balanceId\";DROP INDEX\"main\".\"tb_supplierpay_deviceId\";DROP INDEX\"main\".\"tb_supplierpay_mode\";DROP INDEX\"main\".\"tb_supplierpay_supplierId\";CREATE TABLE\"main\".\"tb_supplierpay\"(\"SupplierPayId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"SupplierId\"INTEGER NOT NULL,\"BalanceId\"INTEGER NOT NULL,\"OriginalPrice\"REAL NOT NULL DEFAULT 0,\"OfferRate\"REAL NOT NULL DEFAULT 100,\"FavorablePrice\"REAL NOT NULL DEFAULT 0,\"Price\"REAL NOT NULL,\"BalancePrice\"REAL NOT NULL,\"ParentBalancePrice\"REAL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"Mode\"INTEGER NOT NULL,\"Remark\"TEXT(100),\"AddTime\"INTEGER NOT NULL,CONSTRAINT\"fk_supplierpay_supplierId\"FOREIGN KEY(\"SupplierId\")REFERENCES\"tb_supplier\"(\"SupplierId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_supplierpay_balanceId\"FOREIGN KEY(\"BalanceId\")REFERENCES\"tb_balance\"(\"BalanceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_supplierpay\"(\"SupplierPayId\",\"SupplierId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"ParentBalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"Remark\",\"AddTime\")SELECT\"SupplierPayId\",\"SupplierId\",\"BalanceId\",\"OriginalPrice\",\"OfferRate\",\"FavorablePrice\",\"Price\",\"BalancePrice\",\"ParentBalancePrice\",\"AdminId\",\"DeviceId\",\"Mode\",\"Remark\",\"AddTime\"FROM\"_tb_supplierpay_old_20200217\";CREATE INDEX\"main\".\"tb_supplierpay_addTime\"ON\"tb_supplierpay\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_adminId\"ON\"tb_supplierpay\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_balanceId\"ON\"tb_supplierpay\"(\"BalanceId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_deviceId\"ON\"tb_supplierpay\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_mode\"ON\"tb_supplierpay\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_supplierpay_supplierId\"ON\"tb_supplierpay\"(\"SupplierId\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_supplierpay';ALTER TABLE\"main\".\"tb_takeout\"RENAME TO\"_tb_takeout_old_20200217\";DROP INDEX\"main\".\"tb_takeout_addTime\";DROP INDEX\"main\".\"tb_takeout_adminId\";DROP INDEX\"main\".\"tb_takeout_deviceId\";DROP INDEX\"main\".\"tb_takeout_finishAdminId\";DROP INDEX\"main\".\"tb_takeout_finishDeviceId\";DROP INDEX\"main\".\"tb_takeout_finishTime\";DROP INDEX\"main\".\"tb_takeout_ispack\";DROP INDEX\"main\".\"tb_takeout_lang\";DROP INDEX\"main\".\"tb_takeout_memberId\";DROP INDEX\"main\".\"tb_takeout_mode\";DROP INDEX\"main\".\"tb_takeout_name\";DROP INDEX\"main\".\"tb_takeout_personCount\";DROP INDEX\"main\".\"tb_takeout_phone\";DROP INDEX\"main\".\"tb_takeout_recheckedcount\";DROP INDEX\"main\".\"tb_takeout_sendTime\";DROP INDEX\"main\".\"tb_takeout_serverTakeoutSessionId\";DROP INDEX\"main\".\"tb_takeout_serverTokenId\";DROP INDEX\"main\".\"tb_takeout_state\";DROP INDEX\"main\".\"tb_takeout_updateTime\";CREATE TABLE\"main\".\"tb_takeout\"(\"TakeoutId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"ServerTokenId\"TEXT(50),\"ServerTakeoutId\"TEXT(50),\"ServerTakeoutSessionId\"TEXT(50),\"State\"INTEGER NOT NULL,\"OriginalTotalPrice\"REAL NOT NULL,\"TotalPrice\"REAL NOT NULL,\"MemberPaidPrice\"REAL NOT NULL,\"PaidPrice\"REAL NOT NULL,\"TotalPaidPrice\"REAL NOT NULL,\"BorrowPrice\"REAL NOT NULL,\"KeepPrice\"REAL NOT NULL,\"Lang\"INTEGER NOT NULL,\"AdminId\"INTEGER NOT NULL,\"DeviceId\"INTEGER NOT NULL,\"MemberId\"INTEGER,\"Mode\"INTEGER NOT NULL,\"IsPack\"INTEGER NOT NULL,\"PersonCount\"INTEGER NOT NULL,\"Name0\"TEXT(50),\"Name1\"TEXT(50),\"Name2\"TEXT(50),\"Request\"TEXT(100),\"Phone\"TEXT(50),\"Address0\"TEXT(100),\"Address1\"TEXT(100),\"Address2\"TEXT(100),\"PrintCount\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"ReCheckedCount\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"FinishAdminId\"INTEGER NOT NULL,\"FinishDeviceId\"INTEGER NOT NULL,\"FinishTime\"INTEGER,\"SendAdminId\"INTEGER,\"SendTime\"INTEGER,\"Remark\"TEXT(100),CONSTRAINT\"fk_takeout_adminId\"FOREIGN KEY(\"AdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_deviceId\"FOREIGN KEY(\"DeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_memberId\"FOREIGN KEY(\"MemberId\")REFERENCES\"tb_member\"(\"MemberId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_sendadminId\"FOREIGN KEY(\"SendAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_finishAdminId\"FOREIGN KEY(\"FinishAdminId\")REFERENCES\"tb_admin\"(\"AdminId\")ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT\"fk_takeout_finishDeviceId\"FOREIGN KEY(\"FinishDeviceId\")REFERENCES\"tb_device\"(\"DeviceId\")ON DELETE RESTRICT ON UPDATE RESTRICT);INSERT INTO\"main\".\"tb_takeout\"(\"TakeoutId\",\"ServerTokenId\",\"ServerTakeoutId\",\"ServerTakeoutSessionId\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"MemberPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"Mode\",\"IsPack\",\"PersonCount\",\"Name1\",\"Name0\",\"Name2\",\"Request\",\"Phone\",\"Address1\",\"Address0\",\"Address2\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"SendAdminId\",\"SendTime\",\"Remark\")SELECT\"TakeoutId\",\"ServerTokenId\",\"ServerTakeoutId\",\"ServerTakeoutSessionId\",\"State\",\"OriginalTotalPrice\",\"TotalPrice\",\"MemberPaidPrice\",\"PaidPrice\",\"TotalPaidPrice\",\"BorrowPrice\",\"KeepPrice\",\"Lang\",\"AdminId\",\"DeviceId\",\"MemberId\",\"Mode\",\"IsPack\",\"PersonCount\",\"NameUG\",\"NameZH\",\"NameEN\",\"Request\",\"Phone\",\"AddressUG\",\"AddressZH\",\"AddressEN\",\"PrintCount\",\"AddTime\",\"ReCheckedCount\",\"UpdateTime\",\"FinishAdminId\",\"FinishDeviceId\",\"FinishTime\",\"SendAdminId\",\"SendTime\",\"Remark\"FROM\"_tb_takeout_old_20200217\";CREATE INDEX\"main\".\"tb_takeout_addTime\"ON\"tb_takeout\"(\"AddTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_adminId\"ON\"tb_takeout\"(\"AdminId\"ASC);CREATE INDEX\"main\".\"tb_takeout_deviceId\"ON\"tb_takeout\"(\"DeviceId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishAdminId\"ON\"tb_takeout\"(\"FinishAdminId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishDeviceId\"ON\"tb_takeout\"(\"FinishDeviceId\"ASC);CREATE INDEX\"main\".\"tb_takeout_finishTime\"ON\"tb_takeout\"(\"FinishTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_ispack\"ON\"tb_takeout\"(\"IsPack\"ASC);CREATE INDEX\"main\".\"tb_takeout_lang\"ON\"tb_takeout\"(\"Lang\"ASC);CREATE INDEX\"main\".\"tb_takeout_memberId\"ON\"tb_takeout\"(\"MemberId\"ASC);CREATE INDEX\"main\".\"tb_takeout_mode\"ON\"tb_takeout\"(\"Mode\"ASC);CREATE INDEX\"main\".\"tb_takeout_name\"ON\"tb_takeout\"(\"Name0\"ASC,\"Name1\"ASC,\"Name2\"ASC);CREATE INDEX\"main\".\"tb_takeout_personCount\"ON\"tb_takeout\"(\"PersonCount\"ASC);CREATE INDEX\"main\".\"tb_takeout_phone\"ON\"tb_takeout\"(\"Phone\"ASC);CREATE INDEX\"main\".\"tb_takeout_recheckedcount\"ON\"tb_takeout\"(\"ReCheckedCount\"ASC);CREATE INDEX\"main\".\"tb_takeout_sendTime\"ON\"tb_takeout\"(\"SendTime\"ASC);CREATE INDEX\"main\".\"tb_takeout_serverTakeoutSessionId\"ON\"tb_takeout\"(\"ServerTakeoutSessionId\"ASC);CREATE INDEX\"main\".\"tb_takeout_serverTokenId\"ON\"tb_takeout\"(\"ServerTokenId\"ASC);CREATE INDEX\"main\".\"tb_takeout_state\"ON\"tb_takeout\"(\"State\"ASC);CREATE INDEX\"main\".\"tb_takeout_updateTime\"ON\"tb_takeout\"(\"UpdateTime\"ASC);UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_takeout';drop table\"_tb_admin_old_20200217\";drop table\"_tb_adminpay_old_20200217\";drop table\"_tb_balance_old_20200217\";drop table\"_tb_balancepay_old_20200217\";drop table\"_tb_member_old_20200217\";drop table\"_tb_memberpay_old_20200217\";drop table\"_tb_printer_old_20200217\";drop table\"_tb_product_old_20200217\";drop table\"_tb_producttype_old_20200217\";drop table\"_tb_request_old_20200217\";drop table\"_tb_supplier_old_20200217\";drop table\"_tb_supplierpay_old_20200217\";drop table\"_tb_takeout_old_20200217\";";

        // Fix Version13
        private string SqlUpdateStatementVersion15 = "drop table if exists\"_tb_admin_old_20200216\";drop table if exists\"_tb_adminpay_old_20200216\";drop table if exists\"_tb_memberpay_old_20200216\";drop table if exists\"_tb_supplierpay_old_20200216\";drop table if exists\"_tb_takeout_old_20200216\";";


        // Add Open cash drawer to printer
        private string SqlUpdateStatementVersion16 = "ALTER TABLE\"main\".\"tb_printer\"RENAME TO\"_tb_printer_old_20200324\";CREATE TABLE\"main\".\"tb_printer\"(\"PrinterId\"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\"PrinterName0\"TEXT(50)NOT NULL,\"PrinterName1\"TEXT(50)NOT NULL,\"PrinterName2\"TEXT(50)NOT NULL,\"PrinterDeviceName\"TEXT(100)NOT NULL,\"PrinterAddress\"TEXT(50),\"PrintType\"INTEGER NOT NULL,\"PrintSize\"INTEGER NOT NULL,\"Lang\"INTEGER NOT NULL,\"Order\"INTEGER NOT NULL,\"IsMain\"INTEGER NOT NULL,\"IsCashDrawer\"INTEGER NOT NULL DEFAULT 0,\"IsEnable\"INTEGER NOT NULL,\"AddTime\"INTEGER NOT NULL,\"UpdateTime\"INTEGER,\"Remark\"TEXT);INSERT INTO\"main\".\"tb_printer\"(\"PrinterId\",\"PrinterName0\",\"PrinterName1\",\"PrinterName2\",\"PrinterDeviceName\",\"PrintType\",\"PrintSize\",\"Lang\",\"Order\",\"IsMain\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\")SELECT\"PrinterId\",\"PrinterName0\",\"PrinterName1\",\"PrinterName2\",\"PrinterDeviceName\",\"PrintType\",\"PrintSize\",\"Lang\",\"Order\",\"IsMain\",\"IsEnable\",\"AddTime\",\"UpdateTime\",\"Remark\"FROM\"_tb_printer_old_20200324\";UPDATE\"main\".\"sqlite_sequence\"SET seq=0 WHERE name='tb_printer';drop table if exists\"_tb_printer_old_20200324\";";
    }
}
